Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Input Box code help

I am hoping for some help, I have an inputbox that asks for the amount
between 0 and 21 the trouble I am having is how to write the code. here is
what I am trying

Do While Sheet2.Range("A21").Value = 0
Dim G1
G1 = InputBox("WHAT WAS THE SCORE FOR THE " & Sheet2.Range("B10").Value & "
AGAINST THE " & Sheet2.Range("B11").Value & " FOR THIS ROUND?")
If G1 0 Or G1 < 21 Then
MsgBox "THE SCORES MUST BE BETWEEN 0 AND 21", vbInformation
Else
Sheet2.Range("B21").Value = G1
End If

I have made a mistake somewhere and can not put my finger on it. I need the
code to warn that the number is not between 0 and 21 and if it is not in
these number to loop until the answer is correct.

Thanks

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Input Box code help

Sorry just noticed what i have done helps if I learn greater and less than

Thanks
Greg
"Greg B" wrote in message
...
I am hoping for some help, I have an inputbox that asks for the amount
between 0 and 21 the trouble I am having is how to write the code. here is
what I am trying

Do While Sheet2.Range("A21").Value = 0
Dim G1
G1 = InputBox("WHAT WAS THE SCORE FOR THE " & Sheet2.Range("B10").Value &
" AGAINST THE " & Sheet2.Range("B11").Value & " FOR THIS ROUND?")
If G1 0 Or G1 < 21 Then
MsgBox "THE SCORES MUST BE BETWEEN 0 AND 21", vbInformation
Else
Sheet2.Range("B21").Value = G1
End If

I have made a mistake somewhere and can not put my finger on it. I need
the code to warn that the number is not between 0 and 21 and if it is not
in these number to loop until the answer is correct.

Thanks

Greg



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Input Box code help

Dim G1 As Variant
Do
G1 = InputBox("WHAT WAS THE SCORE FOR THE " & Sheet2.Range("B10").Value
& _
"AGAINST THE " & Sheet2.Range("B11").Value & " FOR THIS ROUND?")
If (G1 <= 0 Or G1 = 21) And G1 < "" Then
MsgBox "THE SCORES MUST BE BETWEEN 0 AND 21", vbInformation
End If
Loop Until (G1 0 And G1 < 21) Or G1 = ""
If G1 < "" Then
Sheet2.Range("B21").Value = G1
End If


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Greg B" wrote in message
...
I am hoping for some help, I have an inputbox that asks for the amount
between 0 and 21 the trouble I am having is how to write the code. here is
what I am trying

Do While Sheet2.Range("A21").Value = 0
Dim G1
G1 = InputBox("WHAT WAS THE SCORE FOR THE " & Sheet2.Range("B10").Value &
" AGAINST THE " & Sheet2.Range("B11").Value & " FOR THIS ROUND?")
If G1 0 Or G1 < 21 Then
MsgBox "THE SCORES MUST BE BETWEEN 0 AND 21", vbInformation
Else
Sheet2.Range("B21").Value = G1
End If

I have made a mistake somewhere and can not put my finger on it. I need
the code to warn that the number is not between 0 and 21 and if it is not
in these number to loop until the answer is correct.

Thanks

Greg



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Input Box code help

Change this:

If G1 0 Or G1 < 21 Then

to this:

If G1 <= 0 Or G1 21 Then

and add "Loop" after "End If"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Greg B" wrote in message
...
I am hoping for some help, I have an inputbox that asks for the amount
between 0 and 21 the trouble I am having is how to write the code. here is
what I am trying

Do While Sheet2.Range("A21").Value = 0
Dim G1
G1 = InputBox("WHAT WAS THE SCORE FOR THE " & Sheet2.Range("B10").Value &
" AGAINST THE " & Sheet2.Range("B11").Value & " FOR THIS ROUND?")
If G1 0 Or G1 < 21 Then
MsgBox "THE SCORES MUST BE BETWEEN 0 AND 21", vbInformation
Else
Sheet2.Range("B21").Value = G1
End If

I have made a mistake somewhere and can not put my finger on it. I need
the code to warn that the number is not between 0 and 21 and if it is not
in these number to loop until the answer is correct.

Thanks

Greg



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Input Box code help

Thanks for the help

Greg B
"Jon Peltier" wrote in message
...
Change this:

If G1 0 Or G1 < 21 Then

to this:

If G1 <= 0 Or G1 21 Then

and add "Loop" after "End If"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Greg B" wrote in message
...
I am hoping for some help, I have an inputbox that asks for the amount
between 0 and 21 the trouble I am having is how to write the code. here is
what I am trying

Do While Sheet2.Range("A21").Value = 0
Dim G1
G1 = InputBox("WHAT WAS THE SCORE FOR THE " & Sheet2.Range("B10").Value &
" AGAINST THE " & Sheet2.Range("B11").Value & " FOR THIS ROUND?")
If G1 0 Or G1 < 21 Then
MsgBox "THE SCORES MUST BE BETWEEN 0 AND 21", vbInformation
Else
Sheet2.Range("B21").Value = G1
End If

I have made a mistake somewhere and can not put my finger on it. I need
the code to warn that the number is not between 0 and 21 and if it is not
in these number to loop until the answer is correct.

Thanks

Greg







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
Input box code Les Excel Programming 1 April 4th 07 04:12 PM
Pause code, wait for input, no input received, carry on with the code [email protected] Excel Programming 1 September 29th 05 12:19 PM
Input Box Code Please Help!! Struggling Hard!! Excel Programming 3 July 30th 04 12:29 AM
Code for Input Box Laura C Excel Programming 4 June 29th 04 05:27 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 02:14 PM.

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"