Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Adding Worksheets without Switching to it

Steve,
One way:

Dim WS As Worksheet
Set WS = ActiveSheet
ThisWorkbook.Worksheets.Add
WS.Activate

NickHK

"Steve Haack" wrote in message
...
I am unsing the .Copy method to add new worksheets to a workbook, by

copying
a template sheet that is already in the workbook. I am calling the code

from
a command button placed on a home "sheet".

The code works fine, but when it adds the new sheet, it changes the focus

to
it. I would like to know if it is possible to copy/add the new sheet and

not
have it gain the focus?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Adding Worksheets without Switching to it

Slight modification:

Dim WS As Worksheet
Set WS = ActiveSheet
Application.ScreenUpdating = False
ThisWorkbook.Worksheets.Add
WS.Activate
Application.ScreenUpdating = True

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"NickHK" wrote in message
...
Steve,
One way:

Dim WS As Worksheet
Set WS = ActiveSheet
ThisWorkbook.Worksheets.Add
WS.Activate

NickHK

"Steve Haack" wrote in message
...
I am unsing the .Copy method to add new worksheets to a workbook, by

copying
a template sheet that is already in the workbook. I am calling the code

from
a command button placed on a home "sheet".

The code works fine, but when it adds the new sheet, it changes the focus

to
it. I would like to know if it is possible to copy/add the new sheet and

not
have it gain the focus?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Adding Worksheets without Switching to it

And one more modification...
'--
Dim WS As Worksheet
Set WS = ActiveSheet
Application.ScreenUpdating = False
ThisWorkbook.Worksheets.Add Count:=1
WS.Activate
Application.ScreenUpdating = True
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Jon Peltier"

wrote in message
Slight modification:

Dim WS As Worksheet
Set WS = ActiveSheet
Application.ScreenUpdating = False
ThisWorkbook.Worksheets.Add
WS.Activate
Application.ScreenUpdating = True

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"NickHK"
wrote in message
Steve,
One way:

Dim WS As Worksheet
Set WS = ActiveSheet
ThisWorkbook.Worksheets.Add
WS.Activate

NickHK

"Steve Haack"


wrote in message
I am unsing the .Copy method to add new worksheets to a workbook, by

copying
a template sheet that is already in the workbook. I am calling the code

from
a command button placed on a home "sheet".

The code works fine, but when it adds the new sheet, it changes the focus

to
it. I would like to know if it is possible to copy/add the new sheet and

not
have it gain the focus?





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
Short cut for switching between worksheets Paul Gignac Excel Worksheet Functions 2 March 22nd 06 07:37 PM
Switching between Worksheets Dave Peterson[_3_] Excel Programming 0 September 8th 04 02:42 AM
Switching between Worksheets Daniel Brown Excel Programming 2 February 8th 04 10:17 PM
Switching between worksheets Curious[_3_] Excel Programming 2 November 7th 03 04:56 PM
Switching to different worksheets during a macro Bill Barclift Excel Programming 0 October 9th 03 04:16 AM


All times are GMT +1. The time now is 10:17 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"