Prompt for cells on open

  • Thread starter Thread starter cyb3rwolf
  • Start date Start date
C

cyb3rwolf

Hello. I am very new to VBA coding... I have a spreadsheet that each time it
opens, I want it to prompt for a Start Date, End Date, and Employee Number.
Then, take those three pieces of Data, and put them each in specific cells on
my sheet. Anybody help me out in telling me how i would accomplish this?
 
Private Sub Workbook_Open()
Dim StartDate As Date, EndDate As Date, EmployeeNum As String

StartDate = Application.InputBox("Start date?")
EndDate = Application.InputBox("End date?")
EmployeeNum = Application.InputBox("Employee number?")
Range("A1").Value = StartDate
Range("B1").Value = EndDate
Range("C1").Value = EmployeeNum
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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

Back
Top