macro to create view problems

Kade

Active Member
Joined
Jul 20, 2002
Messages
258
Hi

I have a worksheet that I often duplicate (copysheet) within a book.

I need a macro to create three views for each new worksheet.

I tried but (see below) it continues to reset the same name .

How can I get the line where the viewname is named, to say insert the tab name and "A" for the first view "B" for the second, etc.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 13/09/2002 by Kade
'

'
Range("A1:G17").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$G$17"
Range("A1").Select
ActiveWorkbook.CustomViews.Add ViewName:="sht3A", PrintSettings:=True, _
RowColSettings:=True
ActiveWindow.SmallScroll ToRight:=7
Range("H1:N21").Select
ActiveSheet.PageSetup.PrintArea = "$H$1:$N$21"
Range("H1").Select
ActiveWorkbook.CustomViews.Add ViewName:="sht3B", PrintSettings:=True, _
RowColSettings:=True
End Sub


Any other solutions greatfully accepted

thanks Kade
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Watch MrExcel Video

Forum statistics

Threads
1,118,323
Messages
5,571,544
Members
412,402
Latest member
xam99
Top