Hi Gurus,
I am having an issue trying to hide/unhide columns using shapes (not command buttons). I would like to do the following:
1) have the shapes show a "ON" color and "OFF" color (which I have tried to do by overlapping shapes on top of each other
2) when a certain shape is "ON", the columns will hide all other columns except for the ones I have indicated
I don't know if using command buttons will make this easier... The VBA code I am having issues is:
Sub TabPro()
With Sheet1
.Shapes("ProON").Visible = msoCTrue
.Shapes("ProOFF").Visible = msoCFalse
.Shapes("ProInfON").Visible = msoCFalse
.Shapes("ProInfOFF").Visible = msoCTrue
.Shapes("QON").Visible = msoCFalse
.Shapes("QOFF").Visible = msoCTrue
.Shapes("ListON").Visible = msoCFalse
.Shapes("ListOFF").Visible = msoCTrue
.Shapes("VON").Visible = msoCFalse
.Shapes("VOFF").Visible = msoCTrue
.Range("b:G").EntireColumn.Hidden = False
.Range("H:AG").EntireColumn.Hidden = True
End With
End Sub
This is code for only the first set of buttons out of 4. Once correct, I should be able to repeat for the other 3 with minor corrections. I have gotten a few errors when I have tried to test run the above.
I would also ask if you would recommend not using shapes with macro and instead using command buttons. As long as it works, I am open to any suggestions.
Thank you for your assistance.
Best,
VBA Novice
I am having an issue trying to hide/unhide columns using shapes (not command buttons). I would like to do the following:
1) have the shapes show a "ON" color and "OFF" color (which I have tried to do by overlapping shapes on top of each other
2) when a certain shape is "ON", the columns will hide all other columns except for the ones I have indicated
I don't know if using command buttons will make this easier... The VBA code I am having issues is:
Sub TabPro()
With Sheet1
.Shapes("ProON").Visible = msoCTrue
.Shapes("ProOFF").Visible = msoCFalse
.Shapes("ProInfON").Visible = msoCFalse
.Shapes("ProInfOFF").Visible = msoCTrue
.Shapes("QON").Visible = msoCFalse
.Shapes("QOFF").Visible = msoCTrue
.Shapes("ListON").Visible = msoCFalse
.Shapes("ListOFF").Visible = msoCTrue
.Shapes("VON").Visible = msoCFalse
.Shapes("VOFF").Visible = msoCTrue
.Range("b:G").EntireColumn.Hidden = False
.Range("H:AG").EntireColumn.Hidden = True
End With
End Sub
This is code for only the first set of buttons out of 4. Once correct, I should be able to repeat for the other 3 with minor corrections. I have gotten a few errors when I have tried to test run the above.
I would also ask if you would recommend not using shapes with macro and instead using command buttons. As long as it works, I am open to any suggestions.
Thank you for your assistance.
Best,
VBA Novice