A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Setting up and Configuration
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Default Workbook



 
 
Thread Tools Display Modes
  #11  
Old February 12th, 2008, 06:48 PM posted to microsoft.public.excel.setup
Pugs
external usenet poster
 
Posts: 7
Default Default Workbook

Hey,

I appreciate your input and responding so quickly. That sent me down
the macro path so Dave's suggestion dovetailed nicely.

In case it will help anyone else, I had to modify the macro slightly.
I found that when the worksheet is hidden, the 'Sheets("Sheet").Copy
After:=Sheets(Sheets.Count)' function errors out because it cannot find the
hidden sheet. To modify it, I've added code to un-hide the sheet before
copying it, and then hiding it again after copying it.

The scripts now look like this:

Sub NewSheet()
Sheet1.Visible = True
Sheets("Sheet").Select
Sheets("Sheet").Copy After:=Sheets(Sheets.Count)
Sheet1.Visible = xlVeryHidden
End Sub

Sub HideSheetTemplate()
Sheet1.Visible = xlVeryHidden
End Sub

Sub ShowSheetTemplate()
Sheet1.Visible = True
End Sub


"Gord Dibben" wrote:

Excellent and I am happy Dave came up with a better solution with the hidden
worksheet.


Gord


  #12  
Old February 12th, 2008, 07:22 PM posted to microsoft.public.excel.setup
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Default Workbook

If you add:

application.screenupdating = false
your code to unhide, copy, and hide
application.screenupdating = true

You won't see the flickering.

And you could drop this line:
Sheets("Sheet").Select

You didn't do anything once you selected it.


Pugs wrote:

Hey,

I appreciate your input and responding so quickly. That sent me down
the macro path so Dave's suggestion dovetailed nicely.

In case it will help anyone else, I had to modify the macro slightly.
I found that when the worksheet is hidden, the 'Sheets("Sheet").Copy
After:=Sheets(Sheets.Count)' function errors out because it cannot find the
hidden sheet. To modify it, I've added code to un-hide the sheet before
copying it, and then hiding it again after copying it.

The scripts now look like this:

Sub NewSheet()
Sheet1.Visible = True
Sheets("Sheet").Select
Sheets("Sheet").Copy After:=Sheets(Sheets.Count)
Sheet1.Visible = xlVeryHidden
End Sub

Sub HideSheetTemplate()
Sheet1.Visible = xlVeryHidden
End Sub

Sub ShowSheetTemplate()
Sheet1.Visible = True
End Sub

"Gord Dibben" wrote:

Excellent and I am happy Dave came up with a better solution with the hidden
worksheet.


Gord


--

Dave Peterson
  #13  
Old February 12th, 2008, 07:33 PM posted to microsoft.public.excel.setup
Pugs
external usenet poster
 
Posts: 7
Default Default Workbook

Roger that.

Thank you!

"Dave Peterson" wrote:

If you add:

application.screenupdating = false
your code to unhide, copy, and hide
application.screenupdating = true

You won't see the flickering.

And you could drop this line:
Sheets("Sheet").Select

You didn't do anything once you selected it.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:06 AM.


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