2
我尝试使用下面的代码,但无法删除逗号。请帮忙。如何删除给定字符串中的最后一个逗号?
Sub removelastcommas()
Dim i As Integer, str As String
str = Range("A1")
For i = Len(str) To 1
If Mid(str, i, 1) <> "," Then
Exit For
End If
Next
Range("b1") = Left(str, i)
End Sub
' = SUBSTITUTE(A1, “”, “”,LEN(A1)-LEN(SUBSTITUTE(A1, “”, “”)))' –