Sunday, December 11, 2011

How do you put an inputbox for Excel using VB?

I'm trying to make it so when you click the command, it will open an input box for you to be able put the following information in:



First Name (Column A), Last Name (Column B), Company (Column C), Address (Column D), Town (Column E), State/Province (Column F), Zip/Postal (Column G).



Any help is GREATLY appreciated.How do you put an inputbox for Excel using VB?
Note, the code may not work for your version of office; this is for '97:



Make a button on the sheet. Double click on it and a code editor pops up. Also, make a form where you enter the info.



Between where it says ';Private Sub...'; and ';End Sub';, type in:



MyForm.Show



Go to the window where you designed your form and double-click the ';OK'; button (that I assume you made)



A new window pops up, and it say ';Private Sub...'; and ';End Sub';; type in:(note: it's (row,column))

Sheet1.Cells.Item(1,1) = FirstName.Text

Sheet1.Cells.Item(1,2) = LastName.Text

....

Continue with Item(1,3), Item(1,4), etc. until Item(1,7)



this kinda assumes you have some experience, so...if you have trouble understanding this, sorry :(

No comments:

Post a Comment