How to create a new page with a button?

R

Ruben

I would like to create a button by a visual basic code.
On my first sheet I have a button. If I click on this button a new page is
created. On this new page I would like to create a button with a macro code,
but I don't know how. So the button on sheet 2 has to be created by a macro
code behind the button on page 1. In summary, the macro behind the button on
sheet 1 has to include the creation of a new page with a button. Thanks for
helping!
 
D

Don Guillett

I just recorded this.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/21/2008 by Donald B. Guillett
'

'
Sheets.Add
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 249#, 22.5, 47.25,
35.25). _
Select
Selection.OnAction = "Rectangle1_Click"
'OR
'Selection.OnAction = "Macro1"
End Sub
 
R

Ruben

Thanks!!

Don Guillett said:
I just recorded this.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/21/2008 by Donald B. Guillett
'

'
Sheets.Add
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 249#, 22.5, 47.25,
35.25). _
Select
Selection.OnAction = "Rectangle1_Click"
'OR
'Selection.OnAction = "Macro1"
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top