SUBSTITUTE和rept是工作表函数,需要用WORKSHEETFUNCTION来调用。
Sub test()Dim I, j, K As Long
Dim a, b As String
Dim useSheet As Excel.Worksheet
Set useSheet = ThisWorkbook.Worksheets("Sheet1")
a = useSheet.Cells(1, 1).Value
b = Trim(Right(Application.WorksheetFunction.Substitute(a, "_", Application.WorksheetFunction.Rept(" ", Len(a))), Len(a)))
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)