LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Macro/Loop If Statement Help -delete the row with the specific te

I am trying to find all the cells in my worksheet that have "AB" in column
'I' and the AB is highlighted with an interior color = 6 .... then delete the
row .

Here is what I have so far.

FIRSTROW = 1
Do While FIRSTROW 0
FIRSTROW = Application.Match("AB", Range("i:i"), 0)
If Range("a" & FIRSTROW).Interior.ColorIndex = 6 Then
Rows(FIRSTROW & ":" & FIRSTROW).Select
Selection.Delete
End If

'this is the part that is not working. What is happening is that when their
is no match the code bombs so I tried to put an if statement in to change the
firstrow to 0 if their is no match. But the if statement is not working.

If FIRSTROW = Application.Match("AB", Range("i:i"), 0) Is Nothing Then
FIRSTROW = 0
End If
Loop

 
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
macro to keep specific name colomns and delete all others myshak Excel Discussion (Misc queries) 0 March 9th 09 11:01 PM
Macro to delete rows containing specific data Slohcin New Users to Excel 2 December 20th 06 11:52 AM
delete row contains specific word in an macro Jean-Francois Excel Discussion (Misc queries) 4 January 11th 05 11:40 PM
Macro to delete specific rows Steve Excel Programming 12 October 1st 04 11:50 PM
Warning Statement to Delete Macro John M[_5_] Excel Programming 2 November 25th 03 04:09 PM


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