Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default forcing entry in input box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default forcing entry in input box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default forcing entry in input box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default forcing entry in input box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default forcing entry in input box

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing an entry [email protected] Excel Discussion (Misc queries) 3 October 19th 06 10:04 PM
Forcing Combo box entry in VBA Anthony Slater Excel Discussion (Misc queries) 1 December 1st 04 03:09 PM
Forcing an input in a pop up box David Excel Programming 2 October 5th 04 11:31 PM
Forcing a date entry? Junior[_2_] Excel Programming 6 June 26th 04 02:08 AM
Forcing Date Entry rbaxter[_3_] Excel Programming 3 December 16th 03 07:36 PM


All times are GMT +1. The time now is 09:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"