ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet add (https://www.excelbanter.com/excel-programming/405494-worksheet-add.html)

lwm

Worksheet add
 
I am using the following to add worksheets to the active workbook.

ActiveWorkbook.Worksheets.Add

This works except it always adds to the far left.

How do I add new worksheets so that they go from left to right?

What I have done is written a macro that adds up to 15 worksheets and allows
the user to input the header, Tab name and then formats the header and footer
for each new sheet. This makes left to right most usful.



Thanks


Gary Keramidas

Worksheet add
 
don't use both of these, just 2 examples


Sub test()
Dim wsnew As Worksheet
Set wsnew = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
Set wsnew = Worksheets.Add(after:=Worksheets("Sheet2"))
End Sub


--


Gary


"lwm" wrote in message
...
I am using the following to add worksheets to the active workbook.

ActiveWorkbook.Worksheets.Add

This works except it always adds to the far left.

How do I add new worksheets so that they go from left to right?

What I have done is written a macro that adds up to 15 worksheets and allows
the user to input the header, Tab name and then formats the header and footer
for each new sheet. This makes left to right most usful.



Thanks




FSt1

Worksheet add
 
hi
see if this might work for you
ActiveWorkbook.Sheets.Add After:= _
Worksheets(Worksheets.Count)
regards
FSt1

"lwm" wrote:

I am using the following to add worksheets to the active workbook.

ActiveWorkbook.Worksheets.Add

This works except it always adds to the far left.

How do I add new worksheets so that they go from left to right?

What I have done is written a macro that adds up to 15 worksheets and allows
the user to input the header, Tab name and then formats the header and footer
for each new sheet. This makes left to right most usful.



Thanks


lwm

Worksheet add
 
Thank you both for youre quick and helpfull responses.

"FSt1" wrote:

hi
see if this might work for you
ActiveWorkbook.Sheets.Add After:= _
Worksheets(Worksheets.Count)
regards
FSt1

"lwm" wrote:

I am using the following to add worksheets to the active workbook.

ActiveWorkbook.Worksheets.Add

This works except it always adds to the far left.

How do I add new worksheets so that they go from left to right?

What I have done is written a macro that adds up to 15 worksheets and allows
the user to input the header, Tab name and then formats the header and footer
for each new sheet. This makes left to right most usful.



Thanks


FSt1

Worksheet add
 
you're welcome
regards
FSt1

"lwm" wrote:

Thank you both for youre quick and helpfull responses.

"FSt1" wrote:

hi
see if this might work for you
ActiveWorkbook.Sheets.Add After:= _
Worksheets(Worksheets.Count)
regards
FSt1

"lwm" wrote:

I am using the following to add worksheets to the active workbook.

ActiveWorkbook.Worksheets.Add

This works except it always adds to the far left.

How do I add new worksheets so that they go from left to right?

What I have done is written a macro that adds up to 15 worksheets and allows
the user to input the header, Tab name and then formats the header and footer
for each new sheet. This makes left to right most usful.



Thanks



All times are GMT +1. The time now is 10:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com