LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default InputBox Method Logic Problem

I am using the inputbox method to take a number from a user. I want th
inputbox to do the following:

1) if the user does not enter anything, exit sub
2) if the user picks a number 254, disallow it and start again
3) if user picks number <= 254 then proceed

How do I set this code up so that if the user picks 254 then it wil
take the user back the to the initial IF Statment? As modeled, it onl
prompts them once and then proceeds with anwer.


Dim NumberofColumns As Integer
Dim BMax As Integer


NumberofColumns = Application.InputBox(prompt:="Enter Number of 2
Elements", Type:=1)
If NumberofColumns = False Then
MsgBox ("Operation Canceled")
Exit Sub
ElseIf NumberofColumns 254 Then
MsgBox ("You cannot enter a number bigger than 254. Tr
again.")
NumberofColumns = Application.InputBox(prompt:="Enter Number o
2D Elements", Type:=1)
Else
BMax = NumberofColumns
End I

--
Message posted from http://www.ExcelForum.com

 
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
Detecting Cancel in an InputBox Method Connie Excel Discussion (Misc queries) 2 October 19th 06 01:32 PM
Cancel button in Inputbox method MiRa Excel Programming 2 November 14th 03 01:04 PM
Using Arrays in InputBox Method verizon Excel Programming 4 July 20th 03 08:14 AM
Inputbox method using type:=8 - How to Cancel? Joe 90 Excel Programming 0 July 10th 03 12:24 AM
Inputbox method using type:=8 - How to Cancel? Jim Cone Excel Programming 0 July 8th 03 06:15 PM


All times are GMT +1. The time now is 11:41 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"