#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Add Sheets

Hello,
How I can always add a worksheet to the right of all existing, visible
worksheets in a workbook?

Thanks.

Bill


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Add Sheets

Hi Bill,

Try:

=============
Public Sub Tester()
With ActiveWorkbook
.Worksheets.Add After:=.Sheets(.Sheets.Count)
End With
End Sub
'<<=============

---
Regards,
Norman



"Bill" wrote in message
k.net...
Hello,
How I can always add a worksheet to the right of all existing, visible
worksheets in a workbook?

Thanks.

Bill



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Add Sheets

Hi Bill,

Adressing the visible criterion, try:

'=============
Public Sub Tester2()
Dim i As Long

With ActiveWorkbook
For i = .Sheets.Count To 1 Step -1
If .Sheets(i).Visible Then
.Worksheets.Add after:=.Sheets(i)
Exit For
End If
Next i
End With
End Sub
'<<=============

---
Regards,
Norman


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM
Allocate Files to Sheets and Build a Master Sheet which Summarises All Sheets hanuman Excel Programming 0 September 9th 03 11:23 AM


All times are GMT +1. The time now is 07:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"