If statements

M

Miree

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top