what i am trying to do is toggle the color of a shape between red and green. what i have currently (courtesy of a search on this site) is this macro:
it works great when attached to the shape but the only problem is it toggles between no-fill and white. i am assuming i would change it to something along the lines of this:![]()
Sub Oval2_Click() If ActiveSheet.Shapes("Oval 2").Fill.Visible = msoFalse Then ActiveSheet.Shapes("Oval 2").Fill.Visible = msoTrue Else ActiveSheet.Shapes("Oval 2").Fill.Visible = msoFalse End If End Sub
the only problem is i haven't worked with macros in excel before so i don't know what the actual code is for setting it to a color so it obviously won't work.![]()
Sub ShapeClick() If ActiveSheet.Shapes("Oval 3").Fill.ColorInex = Red Then ActiveSheet.Shapes("Oval 3").Fill.ColorIndex = Green Else ActiveSheet.Shapes("Oval 3").Fill.ColorIndex = Red End If End Sub
any help would be very much appreciated, thanks.
PS also i am going to need to do the same thing but instead of filling with a color i am going to need the fill for a shape to toggle between two pictures. Not 100% sure that will be possible though since no everyone that has the excel file will have those files on their computer in the same spot but thought there might be some way to attach them to the excel template.
Bookmarks