ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code not working (https://www.excelbanter.com/excel-programming/423678-code-not-working.html)

Miree

code not working
 
I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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

joel

code not working
 
Try makeing each side of the IF statement a UCASE

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

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


"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


joel

code not working
 
from
If Not UCase(c.Value) = UserForm7.ComboBox4.Text Then

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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


Miree

code not working
 
THat doesnt seem to make a difference, it still does not work

"Joel" wrote:

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

to

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

"Miree" wrote:

I am using the following code it works with numbers but not with test, any
suggestions on what is wrong.

Thank you

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



All times are GMT +1. The time now is 01:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com