Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an input box that receives input and enters it into a cell.
How can I set this up so that simply hitting the OK button without entering text is not allowed? TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since you know to use a variable to assign your input to (I'll use "tester")
add these 2 lines following the inputbox command: If tester = "" then Msgbox "You must enter a Value in the Inputbox" Exit sub "Papa Jonah" wrote: I have an input box that receives input and enters it into a cell. How can I set this up so that simply hitting the OK button without entering text is not allowed? TIA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you want to force an entry, rather than bypass the entry as
JMay's code does: RETRY: If tester = "" Or tester = False then Msgbox "You must enter a Value in the Inputbox" GoTo RETRY: End If The InputBox Function and InputBox Method have different values for Cancel so I added the False in to cover all bases. This will loop until the user makes an entry. You can also write code that forces them to enter the correct data type, i.e. string, integer, range, etc. if not using the InputBox method which provides for defining the expected data type. "Papa Jonah" wrote: I have an input box that receives input and enters it into a cell. How can I set this up so that simply hitting the OK button without entering text is not allowed? TIA |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The first RETRY: should be placed on a line just before the input box so
that when it loops, the InputBox will pop up. Sorry I did not make that clear before. "Papa Jonah" wrote: I have an input box that receives input and enters it into a cell. How can I set this up so that simply hitting the OK button without entering text is not allowed? TIA |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try this one that inputbox will appear if empty Sub InputBoxMust() Dim Datax InputX: Datax = InputBox("Must entry:", "You have to fill the data") If Datax = "" Then GoTo InputX 'back to call inputbox Else MsgBox Datax 'the inputbox data End If End Sub -- Regards, Halim "Papa Jonah" wrote: I have an input box that receives input and enters it into a cell. How can I set this up so that simply hitting the OK button without entering text is not allowed? TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Forcing an entry | Excel Discussion (Misc queries) | |||
Forcing Combo box entry in VBA | Excel Discussion (Misc queries) | |||
Forcing an input in a pop up box | Excel Programming | |||
Forcing a date entry? | Excel Programming | |||
Forcing Date Entry | Excel Programming |