Hello,
I need some help on this VBA.
I need two macros, one has no linked cells, other has linked cells.
Click a shape to toggle black fill and change line color to black. Change linked cell from FALSE to TRUE
Click again, the shape will change back to white fill and line color to R: 240, G: 171, B: 165. Linked cell changes to "FALSE"
There are many tooglebutton oval shapes.
In Shape 1, right click and select "assign marco",select 'Filled oval slots.xlsm'!RoundedRectangle1_Click
Then click "OK". If I click Shape 1, it gives an error that "cannot run the marco .."
Thanks
I need some help on this VBA.
I need two macros, one has no linked cells, other has linked cells.
Click a shape to toggle black fill and change line color to black. Change linked cell from FALSE to TRUE
Click again, the shape will change back to white fill and line color to R: 240, G: 171, B: 165. Linked cell changes to "FALSE"
There are many tooglebutton oval shapes.
In Shape 1, right click and select "assign marco",select 'Filled oval slots.xlsm'!RoundedRectangle1_Click
Then click "OK". If I click Shape 1, it gives an error that "cannot run the marco .."
Code:
Option Explicit
Sub ToggleButton(Optional Dummay As Long)
Dim oBtn As Shape
Dim oShape As Shape
Set oBtn = Worksheets("Sheet1").Shapes(Application.Caller)
'If oBtn.Fill.ForeColor.RGB = RGB(0, 0, 0) Then
'oBtn.Fill.ForeColor.RGB = RGB(255, 255, 255)
'oBtn.Line.ForeColor.RGB = RGB(249, 171, 165)
' Exit Sub
' End If
For Each oShape In Worksheets("Sheet1").Shapes
'If oShape.Title = oBtn.Title Then
If oShape Is oBtn Then
With oShape
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Line.ForeColor.RGB = RGB(0, 0, 0)
End With
Else
With oShape
.Fill.ForeColor.RGB = RGB(255, 255, 255)
.Line.ForeColor.RGB = RGB(249, 171, 165)
End With
End If
'End If
Next oShape
End Sub