Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom Color/Color Index | Excel Discussion (Misc queries) | |||
Chart axes color index vs font color index | Charts and Charting in Excel | |||
fr default color index, need color # | Excel Programming | |||
Form a circle (ie. color specific cells) given specific radius | Excel Programming | |||
Setting Background Color RGB (Always goes to closest index color) | Excel Programming |