Re: Drop Down Selection Including Colour of Cell
Here is the macro:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wsh As Worksheet
Set wsh = ActiveSheet
If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
v = Target.Value
If v = "" Then Exit Sub
Sheets("Sheet2").Activate
Dim rLook As Range
Set rLook = ActiveSheet.Range("People")
For Each r In rLook
If v = r.Value Then
Target.Interior.Color = r.Interior.Color
End If
Next r
wsh.Activate
End Sub
Display More
It needs to be installed on any worksheet that you want to use for this behavior. Note that the macro assumes that the nice colored list of names can always be found on Sheet2.
Because it is worksheet code, it is very easy to install and automatic to use:
[INDENT]1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window[/INDENT]
If you have any concerns, first try it on a trial worksheet.
If you save the workbook, the macro will be saved with it.
If you are using a version of Excel later then 2003, you must save
the file as .xlsm rather than .xlsx
To remove the macro:
[INDENT]1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window[/INDENT]
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-u…e814735(v=office.14).aspx
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
Macros must be enabled for this to work!