View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Works for number but not text

Try changing

If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

If Not UCase(c.Text) = UCase(CStr(UserForm7.ComboBox4.Text)) Then

to get everything on the some footing...

HTH,
Bernie
MS Excel MVP


"Miree" wrote in message
...
I am using the following code it works for numbers but not for text, any
suggestions please

Sub MixerTypeFilter()

If Not UserForm7.ComboBox4.Text = "" Then
Dim MyRange, MyRange1 As Range
Lastrow = Cells(Rows.Count, "DU").End(xlUp).Row
Set MyRange = Sheets("FormulationsDatabase (2)").Range("DU1:DU" & Lastrow)
For Each c In MyRange
If Not UCase(c.Value) = UserForm7.ComboBox4.Text 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 If

End Sub