I am trying to write my first piece of code....
I've added a button to a sheet, and the purpose of the button is to display a view. So the code is:
Private Sub CommandButton1_Click()
ThisWorkbook.CustomViews("_Normal").Show
ThisWorkbook.Worksheets("Share Portfolio").Activate
End Sub
Now, line 3 of this code (in red) is erroneous (apparently) - but I guess the intent is clear. When the view "_Normal" is activated, the worksheet displayed is 'whatever', and not what I want. So I'm trying to insert a line of code to display a particular sheet.
Q1 How do I display a sheet by reference to the sheet name?
Q2 Is there a way to simply display the sheet onto which the button has been placed?
thanks
Bookmarks