Fill Colors using VBA

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello All,


I am hoping there is a pretty simple solution to this. I am using this code to color different cell ranges:

Code:
Sub RequestAvail()    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = -0.349986266670736
        .PatternTintAndShade = 0
    End With
End Sub

Now, I am hoping that I could also fill in the identical cells that are highlighted on another sheet.
To clarify:
The user will select C2:D2 on the "Master Availability" sheet. This code will fill in those cells in this color.
On the sheet "Scheduler" I would like C2:D2 to be filled in the same color.
Whatever cells are selected on the Master Availability will correspond to the cells on the Scheduler sheet.

Any help on this would be greatly appreciated!

Andrew
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try

Code:
Sub RequestAvail()
With Selection
    With .Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = -0.349986266670736
        .PatternTintAndShade = 0
    End With
    With Sheets("Scheduler").Range(.Address).Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = -0.349986266670736
        .PatternTintAndShade = 0
    End With
End With
End Sub
 
Upvote 0
There's no such event which would respond to cell's color change. It can be done, for instance, by pressing some button.
 
Upvote 0
Range(.address) works brilliantly!
Gotta love Excel, just when you think it's gonna be tough, there's something that makes it simple!

Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,656
Members
449,045
Latest member
Marcus05

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