LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default To delete specific color index row

Hi

Not sure why your code isn't running and seeing as how your variable
isn't declared in your post its hard to know what you are trying to
do, though I presume from your title and the gist of the code you are
trying to delete all the instances of yellow rows within the used
range in column A? If so the code below should work for you.

As Norman so rightly said it isn't such a great idea to select things
if you don't have to and it is always a good idea to explicitly
declare your variables. Not only for your own use but when it comes
to posting a problem it is easier for people to read.

Add a new module then paste the code below into it.

Option Explicit
Dim MyCell, MyRng As Range
Dim LstCell As Integer

Sub DeleteYellowRows()

With ActiveSheet

LstCell = [A65536].End(xlUp).Row

Set MyRng = Range("A1:A" & LstCell)

For Each MyCell In MyRng

If MyCell.Interior.ColorIndex = 6 Then

MyCell.EntireRow.Delete

End If

Next MyCell

End With

End Sub

You can then call the macro from the macros menu Alt + F8 from the
main excel application window from here you can assign a keyboard
shortcut to the macro from the options button.

Hope this helps

S



 
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
Custom Color/Color Index FARAZ QURESHI Excel Discussion (Misc queries) 4 February 29th 08 05:19 PM
Chart axes color index vs font color index [email protected] Charts and Charting in Excel 4 December 7th 06 04:05 PM
fr default color index, need color # Janis Excel Programming 3 August 23rd 06 02:31 PM
Form a circle (ie. color specific cells) given specific radius David Excel Programming 5 April 11th 06 03:56 PM
Setting Background Color RGB (Always goes to closest index color) [email protected] Excel Programming 6 December 2nd 05 11:47 PM


All times are GMT +1. The time now is 12:26 AM.

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"