当我对 Test1 子的最后一行进行编码时出现错误。它说“期待=”。有任何想法吗?
Sub selectByUsedRows(usedCol As String, selectCol As String)
n = Range(usedCol).End(xlDown).Row
Range(selectCol & "1:" & selectCol & n).Select
End Sub
Sub Test1()
Dim a As String, b As String
a = "A"
b = "B"
selectByUsedRows (a, b)
End Sub
来自评论的更正代码,谢谢!
Sub selectByUsedRows(usedCol As String, selectCol As String)
n = Range(usedCol & "1").End(xlDown).Row
Range(selectCol & "1:" & selectCol & n).Select
End Sub
Sub Test1()
Dim a As String, b As String
a = "A"
b = "B"
selectByUsedRows a, b
End Sub