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

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,213,557
Messages
6,114,291
Members
448,564
Latest member
ED38

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