ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   does not work when i use 1000 (https://www.excelbanter.com/excel-programming/422816-does-not-work-when-i-use-1000-a.html)

Miree

does not work when i use 1000
 
I have a this code but as soon as i enter numers in the thousandes it doesnt
work properly.

Sub VolumeFilter()
If (UserForm7.TextBox5.Value = "" And UserForm7.TextBox6.Value = "") Then
Exit Sub

If UserForm7.TextBox6.Value = "" Then
UserForm7.TextBox6.Value = UserForm7.TextBox5.Value
End If

If UserForm7.TextBox5.Value = "" Then
UserForm7.TextBox5.Value = UserForm7.TextBox6.Value
End If


Dim MyRange, MyRange1 As Range
lastrow = Cells(Rows.Count, "DW").End(xlUp).Row
Set MyRange = Sheets("FormulationsDatabase (2)").Range("DW1:DW" & lastrow)
For Each c In MyRange
If Not (UCase(c.Value) = UserForm7.TextBox5.Value And UCase(c.Value) <=
UserForm7.TextBox6.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


Bob Phillips[_3_]

does not work when i use 1000
 
See my other post regarding Val'ing the text value.

--
__________________________________
HTH

Bob

"Miree" wrote in message
...
I have a this code but as soon as i enter numers in the thousandes it
doesnt
work properly.

Sub VolumeFilter()
If (UserForm7.TextBox5.Value = "" And UserForm7.TextBox6.Value = "") Then
Exit Sub

If UserForm7.TextBox6.Value = "" Then
UserForm7.TextBox6.Value = UserForm7.TextBox5.Value
End If

If UserForm7.TextBox5.Value = "" Then
UserForm7.TextBox5.Value = UserForm7.TextBox6.Value
End If


Dim MyRange, MyRange1 As Range
lastrow = Cells(Rows.Count, "DW").End(xlUp).Row
Set MyRange = Sheets("FormulationsDatabase (2)").Range("DW1:DW" & lastrow)
For Each c In MyRange
If Not (UCase(c.Value) = UserForm7.TextBox5.Value And UCase(c.Value) <=
UserForm7.TextBox6.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





All times are GMT +1. The time now is 11:47 PM.

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