Basic EXCEL VBA - input to cell help

mattcasim

New Member
Joined
Jan 25, 2005
Messages
12
I am at an intermediatte level of Visual BASIC programming and I thought it would be beneficial to learn how to adapt VB for Excel (i.e. VBA)

I am trying to write code for my spreadsheet that, on a button press, loads a userform with many input boxes/ drop downs etc. The problem I am having is getting the inputs into excel. For one input box, you have to enter age. I want to use VBA to put this in cell (say G5) so a formula in another cell can calculate age group. I.e. using an excel IF foruma which is quite straightforward.

I would appreciate any help / code that would put a string of characters / numbers from a user form text box into a cell on my excell spreadsheet

Thanks
Matt Casim
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
put a button on your userform

double click it and enter the below code

Range("G5") = textbox1

This will work if it is textbox1 they have filled in (Change where necessary)
 
Upvote 0
Maybe I'm misunderstanding you, because this seems somewhat straightfoward, but have you tried:
Code:
Sheets(1).Range("A1").Value = Me.TextBox1.Text

This will take the value of textbox1 and input it to cell A1 on sheet 1. HTH.
 
Upvote 0

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

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