Dear all,

Can anyone to tell me how I can pass agrument from coding of Userform to the coding of worksheet please?
The following coding shown on worksheet("sheet1")
[VBA]
Public Sub CommandButton3_Click()

Call UserForm3.PassMessage(PassGate)
UserForm3.Login_Name.Text = PassGate
If PassGate = 1 Then
ExchangeRate.Show
Else
UserForm3.Show
End If

End Sub

The following second coding shown on the userform
PassGate = 1
'Login_Name.Text = PassGate
PassMessage (PassGate)
Exit Do
Else
Message = MsgBox("The password is not correct!, try again please.", vbDefaultButton1)
Exit Do
Login_Name.Text = ""
PWD.Text = ""
End If
End If
'End If
a = a + 1
Loop
If i <> 1 Then
Message = MsgBox("There is no user name what you input, try an other user ID please.", vbDefaultButton1)
End If

End With
End Sub
Sub PassMessage(ByRef PassGate As Integer)

PassMessageOpen = PassGate
'Login_Name.Text = PassGate
End Sub
[/VBA]
I do not why the complier that could not allow me to pass the argument from coding of userform to the coding of worksheet to show value on the object of textbox on worksheet("sheet1")

Could anyone to tell me how I can write a workable coding to fix this problem please?

Best regards,

Francis