Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pat Pat is offline
external usenet poster
 
Posts: 122
Default Ignore other values

The following code delete rows where colA contains the word "delete"
I need the code to ignore any other values in colA as the code fails on this
aspect.

Private Sub DeleteRows_Click()
Dim X As Long
Dim Y As Long
Y = Range("A65536").End(xlUp).Row
'y= find the last non empty cell in column A
For X = Y To 1 Step -1
'Lcase gets the lower case of the word
If LCase(Cells(X, 1).Value) = "delete" Then
Rows(X).Delete
End If
Next X
End Sub

Anyone familiar with this code?
Thanks
Pat


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Ignore other values

Pat

in what way does it fail ? Works for me assuming just text in the cells.
What do you have in the cells that the code fails on ?

Regards

Trevor


"Pat" wrote in message
...
The following code delete rows where colA contains the word "delete"
I need the code to ignore any other values in colA as the code fails on

this
aspect.

Private Sub DeleteRows_Click()
Dim X As Long
Dim Y As Long
Y = Range("A65536").End(xlUp).Row
'y= find the last non empty cell in column A
For X = Y To 1 Step -1
'Lcase gets the lower case of the word
If LCase(Cells(X, 1).Value) = "delete" Then
Rows(X).Delete
End If
Next X
End Sub

Anyone familiar with this code?
Thanks
Pat




  #3   Report Post  
Posted to microsoft.public.excel.programming
Pat Pat is offline
external usenet poster
 
Posts: 122
Default Ignore other values

Hi Trevor,
I tested the code again and it works fine, I don't know what could have
happened the first time around.
Many thanks for supplying the code.
Pat

"Trevor Shuttleworth" wrote in message
...
Pat

in what way does it fail ? Works for me assuming just text in the cells.
What do you have in the cells that the code fails on ?

Regards

Trevor


"Pat" wrote in message
...
The following code delete rows where colA contains the word "delete"
I need the code to ignore any other values in colA as the code fails on

this
aspect.

Private Sub DeleteRows_Click()
Dim X As Long
Dim Y As Long
Y = Range("A65536").End(xlUp).Row
'y= find the last non empty cell in column A
For X = Y To 1 Step -1
'Lcase gets the lower case of the word
If LCase(Cells(X, 1).Value) = "delete" Then
Rows(X).Delete
End If
Next X
End Sub

Anyone familiar with this code?
Thanks
Pat






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
How do I ignore Graphs zero values. fishy Charts and Charting in Excel 11 August 14th 20 07:18 PM
How do I ignore cell values of zero? cenendra Excel Worksheet Functions 2 February 19th 08 06:02 PM
ignore values in a column mrasker Excel Discussion (Misc queries) 4 October 5th 07 07:42 PM
Ignore N/A values with an area chart SPeterson Charts and Charting in Excel 1 November 14th 05 04:14 PM
how do i sum up a column of time values but ignore negative values Croll New Users to Excel 1 October 11th 05 05:55 PM


All times are GMT +1. The time now is 08:43 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"