I want to write an Excel worksheet that when you open it, the first thing that happens is a popup window that asks the user to enter data into 3 or 4 fields. How would I do this?
2009-06-17T05:46:50Z
I don't just want a popup. I want the popup to prompt the user for information in 3 or 4 fields. The user would then type the info into those fields, and the program should transfer that data to the desired cells on the spreadsheet.
?2009-06-24T12:50:33Z
Favorite Answer
A Comment field will allow you to create a simple popup like message, but that means that Comments will need to be always turned on in the Options for MS-Excel.
To get a more sophisticated message to display will require VBA coding, especially if you want the data to be asked and entered by the messaging routine. I will not be able to give exact details, since you did not specify which cells you wanted to be filled, nor are you sure whether it is 3 or 4 that this is supposed to handle. But here is an example:
Option Explicit Public strTitle2 As String Private Sub Workbook_Open() Do strTitle2 = InputBox("Please enter one of the following three values: " & vbCrLf & _ " • Board" & vbCrLf & _ " • Staff" & vbCrLf & _ " • All" & vbCrLf & _ "This will be used within the report's Title.", _ "Acquire Report Title", "All") strTitle2 = StrConv(strTitle2, vbProperCase) If strTitle2 = "Board" Or strTitle2 = "Staff" Or strTitle2 = "All" Then Range("A1").Select Selection.Value = strTitle2 Else MsgBox "Apparently you are incapable of following simple " & vbCrLf & _ "directions, so give it another attempt!!!" strTitle2 = vbNullString End If Loop Until strTitle2 <> vbNullString End Sub