I am trying to create a button with a macro that will hide columns depending on the text value of that button. There are syntax errors which I cannot solve:
Formula:
Sub View_Stt()
'
' View_Stt Macro
'
If CustAccount.Shapes("View_Stt").Text = "View statement" Then
Columns("J:P").Select
Selection.EntireColumn.Hidden = False
Range("B11").Select
CustAccount.Shapes("View_Stt").Text = "Hide statement"
ElseIf CustAccount.Shapes("View_Stt").Text = "Hide statement" Then
Columns("J:P").Select
Selection.EntireColumn.Hidden = True
Range("B11").Select
CustAccount.Shapes("View_Stt").Text = "View statement"
End If
End Sub
The statement is the totals and VAT summary sections plus the transactions list. Hiding these sections will show just the account. It could also be that I have not referred to the name of the button correctly, but if I have would not know how to find the actual name of it.
I have attached the spreadsheet to this post. The sheet in question is the "CustAccount" sheet and the button has "View statement" text on it.
Any help would be greatly appreciated and I would be happy to clarify my problem further if required.
Bookmarks