Copy Gradient Fill from one cell to another

Bwanna

New Member
Joined
Jan 10, 2018
Messages
13
Trying to copy the background (plain and gradient fills) from one cell to another based on the Dropdown value selected in the first cell. The attached file has macros and conditional formatting.

I'm able to make the following code work if I MANUALLY set the background fill and THEN type in a value and press <enter>. However, it will not work using the Dropdown selection and conditional formatting.

Kinda new to VBA and have tried a number of things, but no luck. I'm thinking it's something to do with the "Private Sub Worksheet_change(ByVal Target As Range)" line...
Thanks for the help!

Code:
Private Sub Worksheet_change(ByVal Target As Range)
    ActiveSheet.Protect
    Application.EnableEvents = True


' Copy Gradient
    If Not Intersect(Target, Range("A1")) Is Nothing Then
        ActiveSheet.Unprotect
        Application.EnableEvents = False
            CopyBkGrndv2 Range("A1"), Range("C1")
            CopyBkGrnd Range("A1"), Range("D1")
        ActiveSheet.Protect
        Application.EnableEvents = True
    End If


End Sub
</enter>
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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