ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input Box (https://www.excelbanter.com/excel-programming/379812-re-input-box.html)

Dave Peterson

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


All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com