Pop up window prompt for name/address upon opening of file

H

HRgal

I have an order form that I have created on an Excel spreadsheet and
would like to insert some code that would have a window pop up to
prompt the user for their name, address and voicemail box #. I would
like the pop up to occur each time the document is opened. I am not
very familiar with VB but I found this code (see below- I already
modified it for my document- cell reference, and text) but don't know
where to put it in the script and how to set it up so that it runs each
time the form gets opened. Also not sure as to where to put the < >
symbols.

Sub getvalue()
Range("B3").Value = InputBox("Enter your Name")
Next
Range("D3").Value = InputBox("Enter your Shipping Address")
Next
Range("H3").Value = InputBox("Enter your Voicemail Box #")
End Sub

Additionally, if my Excel document already contains some data
validation lists will that create a problem and if so whats the best
way to fix it.

My knowledge on VB is pretty lacking...Any help would be greatly
appreciated!
 
J

John Fuller

Put this code in the ThisWorkbook page. Should do what you're looking
for. I would suggest you look into user forms for getting all 3 values
on one popup box (see http://j-walk.com/ss/excel/tips/userformtips.htm
for help).

Sub getvalue()
Range("B3").Value = InputBox("Enter your Name")
Range("D3").Value = InputBox("Enter your Shipping Address")
Range("H3").Value = InputBox("Enter your Voicemail Box #")
End Sub

Private Sub Workbook_Open()
Call getvalue
End Sub
 
H

HRgal

So I have put the information into a user form...do I still need to
utilize the code then? Sorry, this is all very foreign to me...but I
guess the only way to learn is to try it! Where is the This Workbook
page?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top