Sub checkH() Dim lastRow As Long lastRow = Cells(Rows.Count, "H").End(xlUp).Row '获取最后一行

For i = 1 To lastRow
    If Left(Cells(i, "H"), 1) = "C" Then '判断是否以C开头
        Dim numLen As Long
        numLen = Len(Cells(i, "H")) - 1 '获取数字的长度
        Dim str As String
        str = Right(Cells(i, "H"), numLen) '获取数字后面的字符
        Cells(i, "I").Value = str '将字符覆盖到I列
    End If
Next i

End Sub

写一个excel的vba逻辑是检查H列的数据将C+数字后面的字符覆盖到I列

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

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