View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Miree Miree is offline
external usenet poster
 
Posts: 90
Default If statements

Although it is a text box it will be numbers entered

"Bob Phillips" wrote:

Less than or more than with text?

--
__________________________________
HTH

Bob

"Miree" wrote in message
...
I have the following code, i need to alter it now for some other user
inputs
I know i need to change the line
If UCase(c.Value) < UserForm7.TextBox1.Value Then
I need to be able to put , less than one text box and more than another(if
possible ignoring an empty box)
Also if possible i need to just look in the cell to see if it partially
contains what is is text box

Thank you

Sub TSRFilter()
Dim MyRange, MyRange1 As Range
lastrow = Cells(Rows.Count, "DL").End(xlUp).Row
Set MyRange = Sheets("FormulationsDatabase (2)").Range("DL1:DL" & lastrow)
For Each c In MyRange
If UCase(c.Value) < UserForm7.TextBox1.Value Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Delete
End If

End Sub