Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Code not working for text

I am using the following code it works with numbers but not with text any
help would be much appreciated

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Code not working for text

Hi,

I'm not sure what you're trying to achieve - so I don't quite understand
what you class as "not working"

However I did notice that you're variable declarations aren't specific (this
works in other languages - but not VB)

your line should read:
"Dim MyRange as range, MyRange1 As Range"

HTH's


"Miree" wrote:

I am using the following code it works with numbers but not with text any
help would be much appreciated

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Code not working for text

What I am trying to achive is for each row which doesnt match(in the
specified column) what has been entered in text box is deleted. I got the
code from anothother post so don't fully understand it all myself.

Ultimately I want to be able to delete lines based on numbers, exact match
text and contains text. Any help would be much appreciated

"Rob Wills" wrote:

Hi,

I'm not sure what you're trying to achieve - so I don't quite understand
what you class as "not working"

However I did notice that you're variable declarations aren't specific (this
works in other languages - but not VB)

your line should read:
"Dim MyRange as range, MyRange1 As Range"

HTH's


"Miree" wrote:

I am using the following code it works with numbers but not with text any
help would be much appreciated

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

Reply
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
Text join formulas working but act as straight text when modified akkrug New Users to Excel 3 May 14th 08 02:27 PM
Copy text then Past Text into TextBox not working RyanH Excel Programming 4 March 19th 08 10:33 AM
Code not working Maxi[_2_] Excel Programming 3 January 23rd 07 01:37 PM
Wht is this Code not Working ? John Excel Programming 7 December 7th 04 02:09 AM
why this code not working tj Excel Programming 0 September 2nd 03 07:14 PM


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

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

About Us

"It's about Microsoft Excel"