Solved

Excel VBA Filter using coloured cell

Posted on 2014-10-27
3
2,802 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:murbro
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:murbro
ID: 40413953
thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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 how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

860 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