default_name
Board Regular
- Joined
- May 16, 2018
- Messages
- 180
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
Hey guys,
I am trying to implement an input box that appears when the user first opens the workbook.
Here is how I would like it to function:
Here is what I currently have started.
Thanks in advance
I am trying to implement an input box that appears when the user first opens the workbook.
Here is how I would like it to function:
- User opens the workbook
- A prompt appears, which asks the user to enter a balance (which is stored as a variable called 'balance')
- If the user just hits enter or Cancel (without inputting a new balance), then the box disappears, and the value in cell B1 remains unchanged (it remains at whatever value it was already set to prior to opening the workbook)
- If the user enters a value and hits OK or enter, the input box disappears, and the value of cell B1 is updated to reflect the new 'balance'
Here is what I currently have started.
VBA Code:
Private Sub Workbook_Open()
Dim balance As Variant
Do
balance = InputBox("What is your current balance?")
If IsNumeric(balance) Then Exit Do
Range("B1").Value = account
Loop
End Sub
Thanks in advance