I want to create a subroutine that accepts a range as an argument. Something like this:
Sub Test(dataRange As Range)
Sheet2.Range("A1").Cells.value = dataRange.Cells(1, 1)
End Sub
However when I try to select the range on Excel and run it, I get a "Reference is not valid" error.
Note: I am trying to run this by going into the Developer tab and clicking on the "Macros" button. In there I type in Test($A$2:$B$4), and then I get the error.
Is there a way to call a custom VBA subroutine from an Excel spreadsheet and pass arguments to it?
Thanks
Subs with argument list in your macro list...