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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Gettingbetter

Well-known Member
Joined
Oct 12, 2004
Messages
602
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)
 

martinee

Well-known Member
Joined
Nov 4, 2003
Messages
960
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,011
Messages
5,856,823
Members
431,835
Latest member
AJBud2022

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
Top