Reputation: 708
I get an error when I code the final line of the Test1 sub. It says "expecting =". Any ideas?
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
CORRECTED CODE FROM COMMENTS, THANKS!
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
Upvotes: 0
Views: 97
Reputation: 32740
You're calling selectByUsedRows
as if you were calling a function. You don't need the parentheses when calling a subroutine:
selectByUsedRows a, b
Upvotes: 3