这是我到目前为止所拥有的:
Sub TrimColumnD()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Dim c As Range
For Each c In ActiveSheet.UsedRange.Columns("D").Cells
c.Value = WorksheetFunction.Trim(c.Value)
Next c
Next ws
End Sub
修剪功能仅适用于第一个工作表中的单元格。