PDA

View Full Version : Solved: Passing Variables from Sheet Code to Module Code



arkusM
11-06-2009, 10:55 AM
Hello,

I feel like I should know this but :banghead: ....
I am trying to get a value from a target row and pass the string value to a sub (IE_login) but I cannot get the variable to be recognised by the SUb even if I declare the variables as "public" .

Cheers.




Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Cancel = True 'Eliminate Edit status due to doubleclick
myLogin2 = Target.Offset(0, -2)
MyPass2 = Target.Offset(0, -1)
wheretogo2 = Target.Offset(0, 1)
Call IE_login
End Sub

arkusM
11-06-2009, 11:11 AM
Ok. I had a duh moment. :blush forgive me...


Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column() <> 6 Then Exit Sub
Cancel = True 'Eliminate Edit status due to doubleclick
myLogin = Target.Offset(0, -2)
MyPass = Target.Offset(0, -1)
wheretogo = Target.Offset(0, 1)
Debug.Print "MyLogin: " & myLogin
Call IE_login(myLogin, MyPass, wheretogo)
End Sub


Sub IE_login(ByVal myLogin As String, ByVal MyPass As String, ByVal wheretogo As String)