Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Limiting input

I have a spreadsheet that users are going to use for supply request at a
county ambulance service. Within this spreadsheet, I am using an inputbox to
obtain the ambulance number (ie M13, M16,M4) for ambulances that need
narcotics replaced. The max number of columns I allow in the spreadsheet is
5. Therefore, I need to limit the max allowable ambulances entered to be 5.
Below, the two lines of code that obtain this info are listed first. This is
followed by a For...Next loop that will ask the quantity for narcotic for
each ambulance.

How do I check to be sure that no more than five ambulances were entered?

ambString = InputBox("Enter ambulance numbers, separated by commas ", , ,
6000, 4500)
ambulances = Split(ambString, ",")
For i = 0 To UBound(ambulances)
'section gets narcotic order for each ambulance
Next i
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Limiting input

if ubound(ambulances) 4 then
Msgbox "Too many ambulances entered, quitting"
exit sub
end if

--
Regards,
Tom Ogilvy


"WLMPilot" wrote:

I have a spreadsheet that users are going to use for supply request at a
county ambulance service. Within this spreadsheet, I am using an inputbox to
obtain the ambulance number (ie M13, M16,M4) for ambulances that need
narcotics replaced. The max number of columns I allow in the spreadsheet is
5. Therefore, I need to limit the max allowable ambulances entered to be 5.
Below, the two lines of code that obtain this info are listed first. This is
followed by a For...Next loop that will ask the quantity for narcotic for
each ambulance.

How do I check to be sure that no more than five ambulances were entered?

ambString = InputBox("Enter ambulance numbers, separated by commas ", , ,
6000, 4500)
ambulances = Split(ambString, ",")
For i = 0 To UBound(ambulances)
'section gets narcotic order for each ambulance
Next i

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
Limiting input by date NEHicks Excel Discussion (Misc queries) 1 February 1st 10 03:10 PM
Limiting edits alexandra60 Excel Discussion (Misc queries) 3 February 8th 06 09:55 AM
Limiting input with input box petros89[_6_] Excel Programming 1 December 11th 05 02:58 PM
limiting cell value nowfal Excel Discussion (Misc queries) 2 September 9th 05 08:29 PM
Limiting text Sheldon Excel Programming 2 November 2nd 04 04:41 PM


All times are GMT +1. The time now is 03:43 AM.

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

About Us

"It's about Microsoft Excel"