chubbers001
New Member
- Joined
- Nov 4, 2011
- Messages
- 17
I am trying to write a macro that will change the colour fill in a range of cells b11:d13 depending on the colour fill in cells b14:d16. If the colour fill in range b14:d16 is red (or colour 255) then the colour fill in the range b11:b13is to be red (or colour 255), but if the colour fill in range b14:d16 is green (or colour 5287936) then the colour fill in the range b11:d13 is to be green (or colour 5287936). I have tried to write the macro (I am a novice at this) and here is my effort,
Sub CBEarthOFFBC6B()
'
' CBEarthOFFBC6B Macro
'
'
If Range("B14:D16") = Color = 255 Then
Range("B11:D13").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
If Range("B14:D16") = Color = 5287936 Then
Range("B11:D13").Select
ActiveSheet.Unprotect
Range("B11:D13").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("B9").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End If
End Sub
Any assistance would be appreciated thanks
Sub CBEarthOFFBC6B()
'
' CBEarthOFFBC6B Macro
'
'
If Range("B14:D16") = Color = 255 Then
Range("B11:D13").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
If Range("B14:D16") = Color = 5287936 Then
Range("B11:D13").Select
ActiveSheet.Unprotect
Range("B11:D13").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("B9").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End If
End Sub
Any assistance would be appreciated thanks