multiple colours in shape fill or border fill change

richie247

New Member
Joined
Feb 3, 2017
Messages
17
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
good morning,

i have been running this code which works well however sometimes there will be times when there might be an over lap. i need it to display both colours or have the border the first colour.

Sub ShowHideAreas()
Dim sh1 As Worksheet, sh2 As Worksheet, i As Long, j As Long
Dim wRGB As Variant, shp As Object
'
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet2")
'
sh1.Select
For Each shp In sh1.Shapes
If LCase(Left(shp.Name, 6)) = LCase("Area_A") Then
shp.Visible = False
End If
Next
'
For i = 2 To sh2.Range("C" & Rows.Count).End(xlUp).Row
For j = 1 To 52
If sh2.Cells(i, Columns("G").Column + j - 1).Value = True Then
sh1.Shapes.Range(Array("Area_A" & j)).Visible = True
Select Case sh2.Range("C" & i)
Case "*******": wRGB = RGB(255, 204, 153)
Case "******* ": wRGB = RGB(255, 255, 0)
Case "*******": wRGB = RGB(51, 102, 255)
Case "*******": wRGB = RGB(255, 0, 0)
Case "*******": wRGB = RGB(204, 153, 255)
Case "*******": wRGB = RGB(255, 255, 255)
End Select
sh1.Shapes.Range(Array("Area_A" & j)).Select
Selection.ShapeRange.Fill.ForeColor.RGB = wRGB
End If
Next
Next
MsgBox "Done"
End Sub

many thanks in advance
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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