-
Get help for telling me how to code VBA to pass argument from Userform to worksheet
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
-
Howdy and welcome to the board. I have to ask, is this specific to Mac versions of Excel?
Software: LibreOffice 3.3 on Mac OS X 10.6.5
(retired Excel 2003 user, 3.28.2008 )
Humanware: Older than dirt
--------------------
old, slow, and confused
but at least I'm inconsistent!
Rich
-
Dear Rich,
It's really VBA coding of Excel.
-
you can then post in the regular excel forum, which gets more traffic than here. Posting a sample workbook with a description of what you are trying to accomplish will also help people help you.
-
Dear tpoynton,
Many thanks for your suggestion.
-
Assuming you want Textbox data, you can add
[VBA]
Sheets("Sheet1").Range("A1") = Me.Textbox1.Text
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Dear VBAX Wizard,
I fixed the problem already, anyway thanks you very much for your reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules