VBA - Referencing cell colour of other worksheets

PrimoVongol

New Member
Joined
Feb 8, 2019
Messages
2
Hello,

I am looking to to generate a list of values in a worksheet based on if the cells are coloured in other worksheets. I've posted the code below. My thinking is that in the first worksheet, the first cell will check if C1R1 of another worksheet has a filled background or no fill. if filled (regardless of colour) it will copy the value and then increment down a cell and run the again on the next one. I have an extra variable (b) in case i need it.

Sub Opening_Order()
'
' Opening_Order Macro
' Pulls highlighted cells from other worksheets
'
' Variables
Dim n As Integer 'Sheet variable
Dim x As Integer 'Survey Column variable
Dim y As Integer 'Survey Row Variable
Dim a As Integer 'Column variable
Dim b As Integer 'Row variable
a = 1


For n = 2 To 2
For x = 1 To 5
For y = 1 To 5
If Worksheets(n).Cells(x, y).Interior.ColorIndex <> 70 Then
Cells(a, 1).Value = Worksheets(n).Cells(x, y)
a = a + 1
End If
Next y
Next x
Next n


'
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi & welcome to MrExcel.
How about
Code:
         If Worksheets(n).Cells(x, y).Interior.ColorIndex <> xlNone Then
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

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