Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User values from a form in another macro

Status
Not open for further replies.

sogc

Technical User
Jun 8, 2004
34
CA
I am new to VBA in Excel. I need to add two values from a user through a form. Then I want to take the values from that form and use it in a vlookup in the same workbook.

Can someone give me the basics of how to accept the values from a form into a macro. Or how to use the values from the form and execute another macro when the user clicks OK on the form.
 
what have you tried so far ? have you looked at public scope ?

Chance,

Filmmaker, gentleman and ROMAN!
 



Hi,

In your procedure, fully quallify the userform controls that you reference, like
Code:
ptr = application.match(userform1.textbox1.text, sheet1.range([i]rangeref[/i]),0)
In fact, fully quallify ALL references, as per example.

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
If you have a button on the form then simply attach the code to that button. You may reference the controls on the form like:

FormName.ControlName.Value

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top