L
Lynz
Hi, thanks to the very helpful people on here and the net i have the
following code for inserting a new sheet , formatting it naming it etc.
At the end of the code the "owks" has a new name and the "iwks" is
cleared for reuse.
What I need to know is how to activate the newly named worksheet after
all this is done so that it is the one in view. seems simple but I cant
quite get it. Here is the relevant (I think) part of the code.
Thank you for any assistance.
ps the new worksheet has a new name each time.
With oWks.PageSetup
'added margins??
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.1)
.TopMargin = Application.InchesToPoints(0.6)
.BottomMargin = Application.InchesToPoints(0.7)
.HeaderMargin = Application.InchesToPoints(0.4)
.FooterMargin = Application.InchesToPoints(0.5)
.CenterHeader = Range("A2").Value
.CenterFooter = "Page &P of &N"
End With
On Error Resume Next
oWks.Name = Range("A2").Value
'Clear the ws Cat2 so can use it again
iWks.Select
Cells.Select
Selection.Clear
Range("a1").Select
End Sub
following code for inserting a new sheet , formatting it naming it etc.
At the end of the code the "owks" has a new name and the "iwks" is
cleared for reuse.
What I need to know is how to activate the newly named worksheet after
all this is done so that it is the one in view. seems simple but I cant
quite get it. Here is the relevant (I think) part of the code.
Thank you for any assistance.
ps the new worksheet has a new name each time.
With oWks.PageSetup
'added margins??
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.1)
.TopMargin = Application.InchesToPoints(0.6)
.BottomMargin = Application.InchesToPoints(0.7)
.HeaderMargin = Application.InchesToPoints(0.4)
.FooterMargin = Application.InchesToPoints(0.5)
.CenterHeader = Range("A2").Value
.CenterFooter = "Page &P of &N"
End With
On Error Resume Next
oWks.Name = Range("A2").Value
'Clear the ws Cat2 so can use it again
iWks.Select
Cells.Select
Selection.Clear
Range("a1").Select
End Sub