Whenever trying to select a variable range using a subroutine with parameters, I will also receive the error 9 Subscript out of range. If I remove the "ThisWorkBook.Worksheets("Sheet1")" I then receive a Gobal error.
I have tried using different routines such as Cells(x,y)
Sub Trail()
Call SelectRow(2)
End Sub
Sub SelectRow(i As String)
Dim theAddressA As String
Dim theAddressL As String
theAddressA = "A" & i
theAddressL = "L" & i
MsgBox (theAddressA) 'Prints "A2".
MsgBox (theAddressL) 'Prints "L2".
ThisWorkbook.Worksheets("Sheet1").Range("theAddressA:theAddressL").Select
End Sub
I want to be able to select a row based on a variable input, as shown by the subroutine with the argument parameters. Ultimately once I can do this I'd like to compare individual rows with another table to then identify differences and similarities. Debug display image