IF Cell Colour = Yellow, Copy Value to List - VBA

peterhinton

Active Member
Joined
Mar 8, 2016
Messages
336
Hi All,

I am looking for a way to populate a list, based on a range of Cells Background Colour.

The range is C19:C619 on sheet called: Stock and Sales Report.

Any Cell that has background Colour Yellow, i want their values copied and pasted into a list starting in A1 on sheet called: EmulatorInput

Is this possible, where would I start ?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi, you could give this a try.

Code:
Sub m()
Dim c As Range
For Each c In Sheets("Stock and Sales Report").Range("C19:C519")
    If c.Interior.Color = vbYellow Then
        Sheets("EmulatorInput").Range("A" & Rows.Count).End(xlUp).Offset(1).Value = c.Value
    End If
Next c
End Sub
 
Upvote 0
If the cells are colored by conditional then you would need to use this code in place of If c.Interior.Color = vbYellow Then

Code:
If c.DisplayFormat.Interior.Color = vbYellow Then
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top