您好我正在尝试将范围设置为最后一行。
我有
For Each rng In Sheets("Sheet1").Range("B2:CG100").Cells 'adjust sheetname and range accordingly
我试过了
For Each rng In Sheets("Sheet1").Range("B2:CG" & lastRow).Cells 'adjust sheetname and range accordingly
但不工作
问题是最后一行发生了变化,如果我使用整个列 Sub 将永远运行
Sub CleanAll()
Dim rng As Range
For Each rng In Sheets("Sheet1").Range("B2:CG100").Cells 'adjust sheetname and range accordingly
rng.Value = NumberOnly(rng.Value)
Next
End Sub
谢谢