Transferring color with the drop down list value

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
Hello Friends

I am using Excel 2007. In my spreadsheet I have created a drop down list for entering values in cells. The master list (from where the drop down list is reading values) has color formats. Is it possible to format cells of the spreadsheet same as the master list?

For example if I select country Canada from the drop down list and in the master list cell containing Canada has fill color Red, is it possible that the same color Red gets transferred to the sheet where I am making the entry?

Thanks
Rajesh
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hello Friends

I am using Excel 2007. In my spreadsheet I have created a drop down list for entering values in cells. The master list (from where the drop down list is reading values) has color formats. Is it possible to format cells of the spreadsheet same as the master list?

For example if I select country Canada from the drop down list and in the master list cell containing Canada has fill color Red, is it possible that the same color Red gets transferred to the sheet where I am making the entry?

Thanks
Rajesh
Assuming the drop down is from validation and includes the range A1:A10 (change code to suit) and that the list feeding the drop down is in J1:J6 (change code to suit), this worksheet_change event module will do what you want.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rList As Range, n As Long, myColor As Long
'Change next line to range with drop down
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
    Set rList = Range("J1:J6") '<-- change range to suit
    n = Application.Match(Target.Value, rList, 0)
    If n > 0 Then
        myColor = rList.Cells(n).Interior.Color
        Target.Interior.Color = myColor
    End If
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,718
Messages
6,174,082
Members
452,542
Latest member
Bricklin

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