ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do loop to add a new worksheet (https://www.excelbanter.com/excel-programming/307524-do-loop-add-new-worksheet.html)

ALEX

Do loop to add a new worksheet
 
If anyone could help on this...

Stuck on how to do a LOOP to add a new worksheet to the front of a workbook
with unkown amount of worksheets.

I get about as far as:

Dim WrkBk as Integer

WrkBk = ActiveWorkbook.Worksheets.Count

THANKS

Chip Pearson

Do loop to add a new worksheet
 
Alex,

No loop is required. Try something like

With ActiveWorkbook.Worksheets
.Add befo=.Item(1)
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Alex" wrote in message
...
If anyone could help on this...

Stuck on how to do a LOOP to add a new worksheet to the front

of a workbook
with unkown amount of worksheets.

I get about as far as:

Dim WrkBk as Integer

WrkBk = ActiveWorkbook.Worksheets.Count

THANKS




ALEX

Do loop to add a new worksheet
 
PERFECT...THANKS!!!



"Chip Pearson" wrote:

Alex,

No loop is required. Try something like

With ActiveWorkbook.Worksheets
.Add befo=.Item(1)
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Alex" wrote in message
...
If anyone could help on this...

Stuck on how to do a LOOP to add a new worksheet to the front

of a workbook
with unkown amount of worksheets.

I get about as far as:

Dim WrkBk as Integer

WrkBk = ActiveWorkbook.Worksheets.Count

THANKS






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

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