Thread: Input Box
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Input Box

if you use application.inputbox, you can use the "type" parm.

numseries = application.inputbox(...., type:=1)

type:=1
means that the user has to enter a number (any old number) to be able to click
ok.

Andy wrote:

I figured out I needed to add Application

Dim numSeries as Integer
Do While numSeries < 1 Or numSeries 10
numSeries = Application.InputBox("How many series do you want to
graph? _
(Between 1 and 10)", "How Many", "1 to 10")
If numSeries = False Then Exit Sub
Loop

Is there a way to check if the input is in the wrong format?

"Andy" wrote:

I have VBA code as seen below and I want to get it to exit the sub if I
press the Cancel button, but I'm not quite sure how that works.


Dim numSeries as Variant
Do While numSeries < 1 Or numSeries 10
numSeries = InputBox("How many series do you want to graph? _
(Between 1 and 10)", "How Many", "1 to 10")
If numSeries = False Then Exit Sub
Loop


Thanks


--

Dave Peterson