Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding a new sheet (no focus)

Hi all,

I have a workbook with a sheet called "Master" and I am using th
following line of code to add a new sheet called "Test" (if "Test" doe
not already exist) :

Sheets.Add.Name = "Test"

Is it possible to add this new sheet WITHOUT Excel automatically makin
that the active sheet.

TIA

Seamu

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Adding a new sheet (no focus)

Hi Seamus

Don't think so. Here's a workaround:

Sub test()
Dim S As Worksheet, T As Worksheet
Set S = ActiveSheet
On Error Resume Next
Application.ScreenUpdating = False
Set T = Sheets.Add
T.Name = "Test"
T.Move after:=Worksheets(ActiveWorkbook.Worksheets.Count)
S.Activate
Application.ScreenUpdating = True
End Sub

HTH. best wishes Harald

"SOS " skrev i melding
...
Hi all,

I have a workbook with a sheet called "Master" and I am using the
following line of code to add a new sheet called "Test" (if "Test" does
not already exist) :

Sheets.Add.Name = "Test"

Is it possible to add this new sheet WITHOUT Excel automatically making
that the active sheet.

TIA

Seamus


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding a new sheet (no focus)

Thanks Harald,

I'll give that a try

Seamu

--
Message posted from http://www.ExcelForum.com

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
ADDING/DELETING SHEET Without losing focus? Faraz A. Qureshi Excel Discussion (Misc queries) 1 July 29th 09 12:55 PM
HELP!! Unhide Sheet with Macro and focus on other sheet [email protected] Excel Discussion (Misc queries) 2 May 23rd 06 07:17 PM
Printing switches focus off proper sheet Abi Excel Worksheet Functions 1 January 26th 05 07:42 PM
Focus back from modeless userform to sheet RB Smissaert Excel Programming 4 September 5th 03 04:21 PM
Must be a way to force focus back to sheet instead of UserForm - isn't there? Les[_4_] Excel Programming 2 July 29th 03 12:45 PM


All times are GMT +1. The time now is 10:41 PM.

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

About Us

"It's about Microsoft Excel"