ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert worksheet at end (https://www.excelbanter.com/excel-programming/368381-insert-worksheet-end.html)

JamesArchibald[_4_]

Insert worksheet at end
 

Hi,

I am trying to insert a blank worksheet using the code:

Sheets.add

The problem is that the new worksheet inserts itself to the left of the
active sheet. I would like it to appear at the end of the sheets e.g.
Sheet 1, Sheet 2, Sheet 3, new sheet.

Any help would be appreciated.

Thanks


--
JamesArchibald
------------------------------------------------------------------------
JamesArchibald's Profile: http://www.excelforum.com/member.php...o&userid=33284
View this thread: http://www.excelforum.com/showthread...hreadid=565087


Bob Phillips

Insert worksheet at end
 
One of the joyful quirks of Excel. You could do it with VBA, but just as
easy to drag it over.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"JamesArchibald"
<JamesArchibald.2bju1q_1153911305.6918@excelforu m-nospam.com wrote in
message news:JamesArchibald.2bju1q_1153911305.6918@excelfo rum-nospam.com...

Hi,

I am trying to insert a blank worksheet using the code:

Sheets.add

The problem is that the new worksheet inserts itself to the left of the
active sheet. I would like it to appear at the end of the sheets e.g.
Sheet 1, Sheet 2, Sheet 3, new sheet.

Any help would be appreciated.

Thanks


--
JamesArchibald
------------------------------------------------------------------------
JamesArchibald's Profile:

http://www.excelforum.com/member.php...o&userid=33284
View this thread: http://www.excelforum.com/showthread...hreadid=565087




NickHK

Insert worksheet at end
 
James,
Look at the 2nd argument to .Add.
e.g.
With ThisWorkbook
.Sheets.Add , .Worksheets(.Worksheets.Count)
End With

NickHK

"JamesArchibald"
<JamesArchibald.2bju1q_1153911305.6918@excelforu m-nospam.com wrote in
message news:JamesArchibald.2bju1q_1153911305.6918@excelfo rum-nospam.com...

Hi,

I am trying to insert a blank worksheet using the code:

Sheets.add

The problem is that the new worksheet inserts itself to the left of the
active sheet. I would like it to appear at the end of the sheets e.g.
Sheet 1, Sheet 2, Sheet 3, new sheet.

Any help would be appreciated.

Thanks


--
JamesArchibald
------------------------------------------------------------------------
JamesArchibald's Profile:

http://www.excelforum.com/member.php...o&userid=33284
View this thread: http://www.excelforum.com/showthread...hreadid=565087




ChasAA

Insert worksheet at end
 
Hello,

This will do it:

Sub addSheet()
Sheets.Add after:=Worksheets(Worksheets.Count)
End Sub

ChasAA

"JamesArchibald" wrote:


Hi,

I am trying to insert a blank worksheet using the code:

Sheets.add

The problem is that the new worksheet inserts itself to the left of the
active sheet. I would like it to appear at the end of the sheets e.g.
Sheet 1, Sheet 2, Sheet 3, new sheet.

Any help would be appreciated.

Thanks


--
JamesArchibald
------------------------------------------------------------------------
JamesArchibald's Profile: http://www.excelforum.com/member.php...o&userid=33284
View this thread: http://www.excelforum.com/showthread...hreadid=565087




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

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