我正在尝试使用下面的代码删除C列单元格中第一个空格后的文本。出于某种原因,我总是得到运行时错误1004。
Sub keepFirstWord()
With Worksheets("Sheet1")
With .Range(.Cells(0, 1), .Cells(Rows.Count, 1).End(xlUp))
.Replace What:=Chr(32), Replacement:=Space(99), LookAt:=xlPart
.TextToColumns Destination:=Range("A2"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 2), Array(99, 9))
End With
End With
End Sub