How to remove spaces in between text?

后端 未结 10 810
日久生厌
日久生厌 2021-01-13 00:00

Why trim is not working in VBA?

for i = 3 to 2000
activesheet.cells(i,\"C\").value = trim(Activesheet.cells(i,\"C\").value)
next i

It is un

10条回答
  •  长情又很酷
    2021-01-13 00:27

    The VBA Trim function is different than Excel's. Use Excel's Application.WorksheetFunction.Trim function instead.

    Excel Trim will remove all spaces except a single space between words. VBA Trim will remove leading and trailing spaces.

    Thank MS for using the same keyword for different functions.

提交回复
热议问题