You can use InputBoxes or create a UserForm
Option Explicit
Private Sub Workbook_Open()
Dim sName As String
Dim DOB As Date
GetName:
sName = Application.InputBox("what is your name?")
If sName > "" Then
Sheet1.Cells(1, 1).Value = sName
Else: MsgBox "You must enter your name"
GoTo GetName
End If
GetDOB:
DOB = Application.InputBox("what is DOB?")
MsgBox DOB
If DOB > 0 Then
Sheet1.Cells(1, 1).Value = Format(CDate(DOB), "Long Date")
Else: MsgBox "You must enter your DOB"
GoTo GetDOB
End If
End Sub
Copy the code
Select the workbook in which you want to store the code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
In the Project Explorer, find your workbook, and open the list of Microsoft Excel Objects
Right-click on the ThisWorkbook object, and choose View Code
Where the cursor is flashing, choose Edit | Paste
Bookmarks