ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   add non active worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/240293-add-non-active-worksheet.html)

cluckers

add non active worksheet
 
How do I add a new sheet to my acitve workbook without makin it the active
sheet.

I tired

Worksheets.Add().Name = "Sheet2"

but it makes it active.
Normally I cold just active the other sheet but the primary sheet name will
not be consistent.

Luke M

add non active worksheet
 
You could get around not knowing what the current active sheet is by doing
this:

StartPlace = ActiveSheet.Name
Worksheets.Add().Name = "Sheet2"
Sheets(StartPlace).Select
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"cluckers" wrote:

How do I add a new sheet to my acitve workbook without makin it the active
sheet.

I tired

Worksheets.Add().Name = "Sheet2"

but it makes it active.
Normally I cold just active the other sheet but the primary sheet name will
not be consistent.


cluckers

add non active worksheet
 
it gets the compile error "variable not defined".

Dim startplace As Worksheet
Set startplace = ActiveSheet.Name
Worksheets.Add().Name = "Sheet2"
Sheets(startplace).Select

this code returns 'object required'


"Luke M" wrote:

You could get around not knowing what the current active sheet is by doing
this:

StartPlace = ActiveSheet.Name
Worksheets.Add().Name = "Sheet2"
Sheets(StartPlace).Select
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"cluckers" wrote:

How do I add a new sheet to my acitve workbook without makin it the active
sheet.

I tired

Worksheets.Add().Name = "Sheet2"

but it makes it active.
Normally I cold just active the other sheet but the primary sheet name will
not be consistent.


Gord Dibben

add non active worksheet
 
Dim startplace As String
startplace = ActiveSheet.Name
Worksheets.Add().Name = "Sheet14"
Sheets(startplace).Select


Gord Dibben MS Excel MVP

On Thu, 20 Aug 2009 13:17:01 -0700, cluckers
wrote:

it gets the compile error "variable not defined".

Dim startplace As Worksheet
Set startplace = ActiveSheet.Name
Worksheets.Add().Name = "Sheet2"
Sheets(startplace).Select

this code returns 'object required'


"Luke M" wrote:

You could get around not knowing what the current active sheet is by doing
this:

StartPlace = ActiveSheet.Name
Worksheets.Add().Name = "Sheet2"
Sheets(StartPlace).Select
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"cluckers" wrote:

How do I add a new sheet to my acitve workbook without makin it the active
sheet.

I tired

Worksheets.Add().Name = "Sheet2"

but it makes it active.
Normally I cold just active the other sheet but the primary sheet name will
not be consistent.




All times are GMT +1. The time now is 02:27 PM.

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