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

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

For i = 1 To lastRow '循环每一行
    If InStr(1, Cells(i, "H").Value, "C+") > 0 Then '判断是否包含'C+' 
        Dim str As String
        str = Mid(Cells(i, "H").Value, InStr(1, Cells(i, "H").Value, "C+") + 1) '截取'C+'后面的字符
        Cells(i, "J").Value = str '将截取的字符粘贴到J列
        Cells(i, "H").Value = Replace(Cells(i, "H").Value, str, "") '将截取的字符从H列中删除
    End If
Next i

End Sub

Excel VBA 代码:提取 H 列中 'C+' 后面的字符到 J 列

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

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