Sub CutSecondCharacter() Dim lastRow As Long Dim i As Long

lastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row '获取B列最后一行的行号

For i = 1 To lastRow '循环处理每一行
    If Len(Cells(i, "B").Value) > 1 Then '判断B列第二个字符是否存在
        Cells(i, "C").Value = Mid(Cells(i, "B").Value, 2, 1) '将B列第二个字符剪切到C列
        Cells(i, "B").Value = Left(Cells(i, "B").Value, 1) & Right(Cells(i, "B").Value, Len(Cells(i, "B").Value) - 2) '将B列的值去掉第二个字符
    End If
Next i

End Sub

写一个excel的vba逻辑是剪切B列的第二个字符到C列

原文地址: http://www.cveoy.top/t/topic/biK2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录