Solved

Excel VBA Filter using coloured cell

Posted on 2014-10-27
3
3,833 Views
Last Modified: 2014-10-30
Hi

I have an excel spreadsheet where the first cell is coloured yellow if the row has been changed.
What VBA code would I use to filter the spreadsheet so that only rows where the first cell is yellow
are shown in my data range
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
slubek earned 250 total points
ID: 40405883
Why don't you use Filter by color option?
The code in VBA:
    ActiveSheet.Range("$A$1:$A$6").AutoFilter Field:=1, Criteria1:=RGB(255, 255, _
        0), Operator:=xlFilterFontColor

Open in new window

0
 
LVL 12

Assisted Solution

by:sdwalker
sdwalker earned 250 total points
ID: 40407145
Assuming your header is in Row 1 (you have to have a header to use a filter), you would use the Operator xlFilterCellColor

   ActiveSheet.Range("A1:A40").AutoFilter Field:=1, Criteria1:=RGB(255, 255, _
        0), Operator:=xlFilterCellColor
 

Open in new window

0
 

Author Closing Comment

by:Murray Brown
ID: 40413953
thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question