Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I need the following if statement to be true for times when the the text box
Rider5.Text is numbers less than 100 (done), or any text value, or blank. I can put in the or statements but don't know what function to use. 'When rider number is less than lowest rider number or Any text value (entered in error) If Rider5.Text < 100 Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text Thanks |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Two options..
If you dont have any code to be executed after the one you pasted below try If IsNumeric(Rider5.Text) = True Then If Rider5.Text 99 Then Exit Sub End If 'The below codes will be executed only if text or value less than 100 UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End Sub '------------------------------------------------------------------------- Another approach is to have a boolean to validate and Dim blnPass As Boolean If IsNumeric(Rider5.Text) = False Then blnPass = True Else If Rider5.Text < 100 Then blnPass = True End If If blnPass = True Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End If 'Continue with the rest of your code End Sub If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I need the following if statement to be true for times when the the text box Rider5.Text is numbers less than 100 (done), or any text value, or blank. I can put in the or statements but don't know what function to use. 'When rider number is less than lowest rider number or Any text value (entered in error) If Rider5.Text < 100 Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text Thanks |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You can ignore the previous post and try
If Rider5.Value < 100 Or Trim(Rider5.Text) = "" Or IsNumeric(Rider5.Text) = False Then 'your code End If If this post helps click Yes --------------- Jacob Skaria "Jacob Skaria" wrote: Two options.. If you dont have any code to be executed after the one you pasted below try If IsNumeric(Rider5.Text) = True Then If Rider5.Text 99 Then Exit Sub End If 'The below codes will be executed only if text or value less than 100 UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End Sub '------------------------------------------------------------------------- Another approach is to have a boolean to validate and Dim blnPass As Boolean If IsNumeric(Rider5.Text) = False Then blnPass = True Else If Rider5.Text < 100 Then blnPass = True End If If blnPass = True Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End If 'Continue with the rest of your code End Sub If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I need the following if statement to be true for times when the the text box Rider5.Text is numbers less than 100 (done), or any text value, or blank. I can put in the or statements but don't know what function to use. 'When rider number is less than lowest rider number or Any text value (entered in error) If Rider5.Text < 100 Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text Thanks |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Jacob, I put in the code below and it still fails for both text and blank. Is
there something that could be wrong in the way I have the text box properties set up. I have even tried setting default value of box to "blank" and if rider5.text ="blank" then, just to see if I could work with text and it failed too. Only seems to want to work with numbers for some reason. Thanks "Jacob Skaria" wrote: You can ignore the previous post and try If Rider5.Value < 100 Or Trim(Rider5.Text) = "" Or IsNumeric(Rider5.Text) = False Then 'your code End If If this post helps click Yes --------------- Jacob Skaria "Jacob Skaria" wrote: Two options.. If you dont have any code to be executed after the one you pasted below try If IsNumeric(Rider5.Text) = True Then If Rider5.Text 99 Then Exit Sub End If 'The below codes will be executed only if text or value less than 100 UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End Sub '------------------------------------------------------------------------- Another approach is to have a boolean to validate and Dim blnPass As Boolean If IsNumeric(Rider5.Text) = False Then blnPass = True Else If Rider5.Text < 100 Then blnPass = True End If If blnPass = True Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End If 'Continue with the rest of your code End Sub If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I need the following if statement to be true for times when the the text box Rider5.Text is numbers less than 100 (done), or any text value, or blank. I can put in the or statements but don't know what function to use. 'When rider number is less than lowest rider number or Any text value (entered in error) If Rider5.Text < 100 Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text Thanks |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
My apologies Jacob. I just changed the rider5.text <100 to rider5.value<100
and everything works fine now. You were on the money yet again "Jacob Skaria" wrote: You can ignore the previous post and try If Rider5.Value < 100 Or Trim(Rider5.Text) = "" Or IsNumeric(Rider5.Text) = False Then 'your code End If If this post helps click Yes --------------- Jacob Skaria "Jacob Skaria" wrote: Two options.. If you dont have any code to be executed after the one you pasted below try If IsNumeric(Rider5.Text) = True Then If Rider5.Text 99 Then Exit Sub End If 'The below codes will be executed only if text or value less than 100 UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End Sub '------------------------------------------------------------------------- Another approach is to have a boolean to validate and Dim blnPass As Boolean If IsNumeric(Rider5.Text) = False Then blnPass = True Else If Rider5.Text < 100 Then blnPass = True End If If blnPass = True Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End If 'Continue with the rest of your code End Sub If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I need the following if statement to be true for times when the the text box Rider5.Text is numbers less than 100 (done), or any text value, or blank. I can put in the or statements but don't know what function to use. 'When rider number is less than lowest rider number or Any text value (entered in error) If Rider5.Text < 100 Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text Thanks |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Or IsNumeric(Rider5.Text) = False Then
This statement alone handles blank cells too. "NDBC" wrote: My apologies Jacob. I just changed the rider5.text <100 to rider5.value<100 and everything works fine now. You were on the money yet again "Jacob Skaria" wrote: You can ignore the previous post and try If Rider5.Value < 100 Or Trim(Rider5.Text) = "" Or IsNumeric(Rider5.Text) = False Then 'your code End If If this post helps click Yes --------------- Jacob Skaria "Jacob Skaria" wrote: Two options.. If you dont have any code to be executed after the one you pasted below try If IsNumeric(Rider5.Text) = True Then If Rider5.Text 99 Then Exit Sub End If 'The below codes will be executed only if text or value less than 100 UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End Sub '------------------------------------------------------------------------- Another approach is to have a boolean to validate and Dim blnPass As Boolean If IsNumeric(Rider5.Text) = False Then blnPass = True Else If Rider5.Text < 100 Then blnPass = True End If If blnPass = True Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text End If 'Continue with the rest of your code End Sub If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I need the following if statement to be true for times when the the text box Rider5.Text is numbers less than 100 (done), or any text value, or blank. I can put in the or statements but don't know what function to use. 'When rider number is less than lowest rider number or Any text value (entered in error) If Rider5.Text < 100 Then UnkRow = Sheets("Unknown").Cells(Rows.Count, "A").End(xlUp).Row + 1 Sheets("Unknown").Range("A" & UnkRow) = Rider5.Text Sheets("Unknown").Range("B" & UnkRow) = Time5.Text Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Highlight/Select text in User Form? | Excel Discussion (Misc queries) | |||
Adding a new text box to user form | Excel Discussion (Misc queries) | |||
User Form: Cannot Update Text Box | Excel Discussion (Misc queries) | |||
user form question: text box to display result | Excel Discussion (Misc queries) | |||
Use a text box to calculate and show results in a user form | Excel Discussion (Misc queries) |