ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prompt for cells on open (https://www.excelbanter.com/excel-programming/415587-prompt-cells-open.html)

cyb3rwolf

Prompt for cells on open
 
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?

Bob Phillips

Prompt for cells on open
 
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)

"cyb3rwolf" wrote in message
...
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?





All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com