OK... let's take a look at this.
In the Visual Basic Editor, make sure you Properties window is turned on.
(Either select View-> Properties, or hit an F4)
And your Project Explorer is open (View -> Project Explorer or Ctrl-R)

Now, select your userform in the Project Explorer under "Forms".

Now, select your userform in the design window.
The properties window will show the name of the userform.

(for instance, Mine says: (Name) Form_PMTR_Open)
Now select your textbox:  What is the name of the textbox?
(Mine is txt_PMTRno)

Now, in your code:
(for instance, I have a button that says "OK", right clicking on the button and
selecting "View Code" takes you to the click event for that button.)

I can check the value of the textbox by using:

Userformname.textboxname.value
Or in this case, I have a global Variable called PMTRno
in the code I have:

PMTRno = Form_PMTR_Open.txt_PMTRno.Value

Now, if I wanted to put this into a cell, I could use:
Range("A10") = PMTRno
or
Cells(10,1) = PMTRno

You'll also notice that once you've entered:

PMTRno = Form_PMTR_Open.

Excel/VBA will begin showing you "possible" solutions to your next part,
or the objects associated with the userform:
for example, in my case, it shows:
Activecontrol
Backcolor
Btn_Cancel
...
once you enter:
PMTRno = Form_PMTR_Open.txt_PMTRno.
it shows the possible objects associated with that control:
AddItem
AutoSize
AutoTab
...

hope this helps get you started...

Paul



________________________________
From: C4 <forsyth.cla...@gmail.com>
To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
Sent: Monday, September 21, 2009 9:10:33 AM
Subject: $$Excel-Macros$$ Pasting UserForm values into a Worksheet


Hi all, this is my first post! I have wanted to learn a bit of coding
for quite some time and the opportunity has finally presented itself
to do so; I am working on a small project for my employer which is
nothing more than a UserForm (with some TextBox and ComboBox controls)
to allow for a simple data entry GUI in Excel. I am a total newb. I
have tried many, many different combinations of code based on "Help"
samples and from all over the web. Can someone please steer me in the
right direction? I can only assume I haven't yet looked in the right
place, and that what I want Excel to do for me is fully possible. Once
I can successfully transfer data from the UserForm, I was planning to
code an "if...then" variable to make sure nothing gets written over,
but at this point I would be overjoyed to get beyond merely creating
the UserForm.

Thanks in advance :)



--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to