我需要关闭第一行,所以我将 Sub 中的范围从
For Each rng In Sheets("360").Range("B:CJ" & Lastrow)
至
For Each rng In Sheets("360").Range("B2:CJ2" & Lastrow)
子知道大麦运行它需要 5 秒才能运行并且知道即使它完成也需要几分钟
如何解决这个问题?
谢谢
Sub CleanAll()
Dim rng As Range
Dim Lastrow As Long
With Sheets("360")
Lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
For Each rng In Sheets("360").Range("B2:CJ" & Lastrow)
rng.Value = NumberOnly(rng.Value)
Next
End Sub
功能
Function NumberOnly(strSource As String) As String
Dim i As Integer
Dim strResult As String
For i = 1 To Len(strSource)
Select Case Asc(Mid(strSource, i, 1))
Case 32, 48 To 57, 65, 78:
strResult = strResult & Mid(strSource, i, 1)
End Select
Next
NumberOnly = strResult
End Function