以下是在每个单词前加上数字。是否有相同的公式可以从电子表格中的每个单词的开头删除数字。这是公式how to insert numbers before every word in excel
的链接Sub test()
Dim cl As Range, i&
Set cl = Cells.Find("*")
For i = 1 To WorksheetFunction.CountA(Cells)
If Not cl Is Nothing Then
cl.Value2 = i & "/" & cl.Value2
Set cl = Cells.FindNext(cl)
Else
Exit For
End If
Next i
End Sub
答案 0 :(得分:2)
使用相同的代码,但不是插入数字,而是通过
删除它Sub test()
Dim cl As Range, i&
Set cl = Cells.Find("*")
For i = 1 To WorksheetFunction.CountA(Cells)
If Not cl Is Nothing Then
cl.Value2 = RIGHT(cl.Value2,LEN(cl.Value2)-InStr(cl.Value2, "/")-1)
Set cl = Cells.FindNext(cl)
Else
Exit For
End If
Next i
End Sub