Hi All,
I'm in need a of a bit of assistance. I have created a map of my company's regions that I want to use in a larger workbook. To put it simply, if a certain cell changes (it's currently a drop down), I want to change the color of that region to green, and the rest to black, essentially highlighting the desired region. Highlighting the region is working for me, but making the rest black is not. Can someone take a look at this code and/or the attached workbook and tell me what I'm doing wrong? Thanks in advance!
File in Google Drive: Marco Help Needed.xlsm - Google Drive
I'm in need a of a bit of assistance. I have created a map of my company's regions that I want to use in a larger workbook. To put it simply, if a certain cell changes (it's currently a drop down), I want to change the color of that region to green, and the rest to black, essentially highlighting the desired region. Highlighting the region is working for me, but making the rest black is not. Can someone take a look at this code and/or the attached workbook and tell me what I'm doing wrong? Thanks in advance!
Code:
Private Sub Worksheet_Change(ByVal Target As Range) If Target(1, 1).Address = Range("Q2").Address Then
Dim Region As Range
Set Region = Range("Q2")
If Region = "International" Then
Range("S2").Value = "Group_Southeast" 'This line can be deleted once the macro is figured out
With ActiveSheet.Shapes.Range(Array("Group_Southeast"))
.ZOrder msoBringToFront
.ShapeStyle = msoLineStylePreset11
End With
Else
Range("S2").Value = "Group_" & Region 'This line can be deleted once the macro is figured out
With ActiveSheet.Shapes.Range(Array("Group_" & Region))
.ZOrder msoBringToFront
.ShapeStyle = msoLineStylePreset11
End With
End If
'Problem happens here
Dim GrpShape As Shape
For Each GrpShape In ActiveSheet.Shapes
If GrpShape <> "Group_" & Region Then 'This line is broken
With ActiveSheet.Shapes
.SelectAll
.ShapeStyle = msoLineStylePreset8
End With
End If
Next GrpShape
End If
End Sub
File in Google Drive: Marco Help Needed.xlsm - Google Drive