Just starting with user forms

JimM

Well-known Member
Joined
Nov 11, 2003
Messages
752
Hi guys

Just starting to look at user forms !!

I've seen a couple of tutorials etc that show how to use user forms to populate a spreadsheet but can I want to use one to display info lifted from a spreadsheet.

Just to get me started can someone tell me how I could get a user form to display the contents of cell A1 from a given spreadsheet or point me towards a tutorial that covers this

Thanks

Jim
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
At its simplest, assuming you've already created a text box called TextBox1 on the user form, right-click the background of the user form and select UserForm and Initialize from the drop-downs, add this line to the UserForm_Initialize event handler:-
Code:
TextBox1 = Range("A1")
Now run the user form by pressing F5 or clicking the green 'run' triangle.

Yes?

(I've coded Range("A1") but you need to make sure you're actually looking at the correct workbook and worksheet at all times.)

Now change that to:-
Code:
TextBox1 = Range("A1")
Range("B1")=TextBox1.Value * 2
and run the form again. Check the contents of cell B1.

Finally create a second text box called TextBox2 and also a command button, right-click the command button and View Code. In the event handler it creates - probably called CommandButton1_Click - add this code:-
Code:
TextBox2 = TextBox1.Value * 99
and run the form again. Check the contents of the second text box.

Get the idea?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,233
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top