Hi I tried to add the worksheet information to a range variable which was passed from a main routine. "Received_range" is the range variable received and all of the three lines below has resulted in error.
a. Set localrange = Sheets("Sheet1").received_range
b. Set localrange = Sheets("Sheet1").Range("received_range")
c. Set localrange = Sheets("Sheet1").Range(received_range)
What should I do to correct it?
Subroutines are as follows:
Sub testing()
Dim passing_range As Range
rng = Range("A1")
Call calledpro(passing_range)
End Sub
Sub calledpro(received_range As Range)
Dim localrange As Range
'trial 1
Set localrange = Sheets("Sheet1").received_range
'trial 2
Set localrange = Sheets("Sheet1").Range("received_range")
'trial 3
Set localrange = Sheets("Sheet1").Range(received_range)
End Sub
a. Set localrange = Sheets("Sheet1").received_range
b. Set localrange = Sheets("Sheet1").Range("received_range")
c. Set localrange = Sheets("Sheet1").Range(received_range)
What should I do to correct it?
Subroutines are as follows:
Sub testing()
Dim passing_range As Range
rng = Range("A1")
Call calledpro(passing_range)
End Sub
Sub calledpro(received_range As Range)
Dim localrange As Range
'trial 1
Set localrange = Sheets("Sheet1").received_range
'trial 2
Set localrange = Sheets("Sheet1").Range("received_range")
'trial 3
Set localrange = Sheets("Sheet1").Range(received_range)
End Sub