PDA

View Full Version : Solved: Passing a variable



ukdane
01-16-2009, 08:00 AM
Can someone please help me with this code.
Sub sortall()
mysort="G"
sort
End Sub

Sub sort
Dim e
e= Range ("Sheet1!" & mysort & "5").Value
'do some other stuff

End Sub


I just want mysort in the Sub sort to = whatever variable I pass to it in another part of the code.

Thanks

Bob Phillips
01-16-2009, 08:20 AM
Sub sortall()
sort "G"
End Sub

Sub sort( ByVal mysort As String)
Dim e
e= Range ("Sheet1!" & mysort & "5").Value
'do some other stuff

End Sub