【发布时间】:2020-10-01 04:07:09
【问题描述】:
我正在尝试删除“A”列的每个字段中的空格,这些空格位于字符串的末尾,其中一些字符串有 3 个空格,其他 4. 当我运行代码时,我不'没有错误,所以我认为我有一个错误,因为运行时没有发生任何事情。
Dim result As String
Last = Cells(Rows.Count, "A").End(xlUp).Row
For i = Last To 1 Step -1
If (Right(Cells(i, "A").Value, 4)) Like " " Or (Right(Cells(i, "A").Value, 3)) Like " " Then
result = Replace(Cells(i, "A"), " ", "")
End If
Next i
【问题讨论】: