LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default no empty values in inputbox

It is difficult to tell how you have the input box set up, but I will try to
give you a general solution that you can apply. Normally, you would set up
your validation loop to fire immediately after the user makes or does not
make the input. Here is one example.
RETRY:
myResult = InputBox("Enter something", "Title")
If myResult = "" Or myResult = False Then
GoTo RETRY:
Else
'You regular code
End If

This will force them to put something in the input box. The problem is,
that they could put anything in there and that might cause an error in the
regular processing.
If you have specific data that needs to be entered that the user could
choose from, it might be better to build a UserForm that provides the user
with a list to select from and control their selection that way.

" wrote:

Hey everyone...
I'm working on a macro with an inputbox and I don't want there to be
any empty boxes. I want the user to be forced to put *something* in
the boxes before the code will continue.

I'm imagining it has to go somewhere in my FOR NEXT loop...

For Each cItem In Me.Controls
If TypeName(cItem) = "TextBox" Then
'another if statement here? PLEASE HELP!!
sSPN = sSPN + cItem.Value + "-"
End If
Next cItem

 
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
Empty Chart Values [email protected] Excel Worksheet Functions 0 September 3rd 06 05:31 AM
Match Inputbox Value on Values in Column van Excel Programming 3 February 22nd 05 04:08 PM
Fix InputBox - Returning Empty String spurtniq[_3_] Excel Programming 7 December 31st 03 06:23 PM
Coping values to the next empty row Richard James[_2_] Excel Programming 1 August 19th 03 07:38 AM


All times are GMT +1. The time now is 05:49 AM.

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"