LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default works with numbers but not text

I missed a closing paren:

set myrange = .range("DL1:DL" & lastrow
should be:
set myrange = .range("DL1:DL" & lastrow)

Dave Peterson wrote:

One mo

Sub MixerTypeFilter()

Dim MyRange as range
dim MyRange1 As Range
dim c as range
dim LastRow as long

with sheets("FormulationsDatabase (2)")
lastrow = .Cells(.Rows.Count, "DL").End(xlUp).Row
set myrange = .range("DL1:DL" & lastrow
end with

If UserForm7.ComboBox4.Text < "" Then
set myrange1 = nothing
For Each c In MyRange.cells
If UCase(c.Value) = ucase(UserForm7.ComboBox4.Text) Then
If MyRange1 Is Nothing Then
Set MyRange1 = c
Else
Set MyRange1 = Union(MyRange1, c)
End If
End If
Next c
If MyRange1 Is Nothing Then
'nothing found to delete
else
MyRange1.entirerow.Delete
End If
End If

End Sub

Miree wrote:

I am using the following code, it works fine with numbers but not with text,
can anyone help please
Sub MixerTypeFilter()

If Not UserForm7.ComboBox4.Text = "" Then
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 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


--

Dave Peterson


--

Dave Peterson


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Works for number but not text Miree Excel Programming 1 February 9th 09 03:03 PM
Works on numbers but not on TEXT CLR Excel Programming 2 June 1st 07 06:45 PM
filter works on letters not numbers Churley Excel Discussion (Misc queries) 2 May 29th 07 03:24 PM
Formula that works like text-to-column linglc Excel Worksheet Functions 6 March 9th 07 12:20 AM
External link only works for numbers -- for text values, #N/A is displayed unless linked file is open Sven Filter Links and Linking in Excel 1 February 22nd 05 08:10 AM


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"