PC Review


Reply
Thread Tools Rate Thread

Activate Sheet

 
 
Martin
Guest
Posts: n/a
 
      31st Dec 2008
Hello,

I have some code that formats my workbook which is below:

Sub Format()
Application.DisplayFullScreen = True
Application.CommandBars("Worksheet Menu Bar").Enabled = False

Sheets("Main Menu").Select
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With

Sheets("H1").Activate
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With

Sheets("H2").Activate
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With

Sheets("Main Menu").Select

End Sub

I run this when the workbook is opened by the user and only takes a second
to run however the user can see the sheets being selected and then revert
back to the main menu.

I was wondering if there is a way to get the code to point to the sheets H1
and H2 but without actually selecting it or the user seeing them being
selected.

I appreciate this is purely cosmetic but it would make the front end look a
little better.

Thanks in advance for your help.

Martin
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      31st Dec 2008
Use the title of the window for this code to work like book1.xls. These
properties don't apply to individual worksheets.

Sub Format()
Application.DisplayFullScreen = True
Application.CommandBars("Worksheet Menu Bar").Enabled = False

With Windows("Main Menu")
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With

With Windows("H1")
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With

With Windows("H2")
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayWorkbookTabs = False
End With

End Sub


"Martin" wrote:

> Hello,
>
> I have some code that formats my workbook which is below:
>
> Sub Format()
> Application.DisplayFullScreen = True
> Application.CommandBars("Worksheet Menu Bar").Enabled = False
>
> Sheets("Main Menu").Select
> With ActiveWindow
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> Sheets("H1").Activate
> With ActiveWindow
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> Sheets("H2").Activate
> With ActiveWindow
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> Sheets("Main Menu").Select
>
> End Sub
>
> I run this when the workbook is opened by the user and only takes a second
> to run however the user can see the sheets being selected and then revert
> back to the main menu.
>
> I was wondering if there is a way to get the code to point to the sheets H1
> and H2 but without actually selecting it or the user seeing them being
> selected.
>
> I appreciate this is purely cosmetic but it would make the front end look a
> little better.
>
> Thanks in advance for your help.
>
> Martin

 
Reply With Quote
 
Martin
Guest
Posts: n/a
 
      31st Dec 2008
Joel,

Sorry, I have tried this and the error message says script out of range.

Any ideas on this?

Martin

"Joel" wrote:

> Use the title of the window for this code to work like book1.xls. These
> properties don't apply to individual worksheets.
>
> Sub Format()
> Application.DisplayFullScreen = True
> Application.CommandBars("Worksheet Menu Bar").Enabled = False
>
> With Windows("Main Menu")
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> With Windows("H1")
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> With Windows("H2")
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> End Sub
>
>
> "Martin" wrote:
>
> > Hello,
> >
> > I have some code that formats my workbook which is below:
> >
> > Sub Format()
> > Application.DisplayFullScreen = True
> > Application.CommandBars("Worksheet Menu Bar").Enabled = False
> >
> > Sheets("Main Menu").Select
> > With ActiveWindow
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > Sheets("H1").Activate
> > With ActiveWindow
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > Sheets("H2").Activate
> > With ActiveWindow
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > Sheets("Main Menu").Select
> >
> > End Sub
> >
> > I run this when the workbook is opened by the user and only takes a second
> > to run however the user can see the sheets being selected and then revert
> > back to the main menu.
> >
> > I was wondering if there is a way to get the code to point to the sheets H1
> > and H2 but without actually selecting it or the user seeing them being
> > selected.
> >
> > I appreciate this is purely cosmetic but it would make the front end look a
> > little better.
> >
> > Thanks in advance for your help.
> >
> > Martin

 
Reply With Quote
 
Howard31
Guest
Posts: n/a
 
      31st Dec 2008
Hi Joel,

Try The following statement at the beginning of the precedure:
Application.ScreenUpdating = False

Than at the end of the procedure set it back to True:

Application.ScreenUpdating = True

Hope that will help

--
A. Ch. Eirinberg


"Joel" wrote:

> Use the title of the window for this code to work like book1.xls. These
> properties don't apply to individual worksheets.
>
> Sub Format()
> Application.DisplayFullScreen = True
> Application.CommandBars("Worksheet Menu Bar").Enabled = False
>
> With Windows("Main Menu")
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> With Windows("H1")
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> With Windows("H2")
> .DisplayGridlines = False
> .DisplayHeadings = False
> .DisplayWorkbookTabs = False
> End With
>
> End Sub
>
>
> "Martin" wrote:
>
> > Hello,
> >
> > I have some code that formats my workbook which is below:
> >
> > Sub Format()
> > Application.DisplayFullScreen = True
> > Application.CommandBars("Worksheet Menu Bar").Enabled = False
> >
> > Sheets("Main Menu").Select
> > With ActiveWindow
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > Sheets("H1").Activate
> > With ActiveWindow
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > Sheets("H2").Activate
> > With ActiveWindow
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > Sheets("Main Menu").Select
> >
> > End Sub
> >
> > I run this when the workbook is opened by the user and only takes a second
> > to run however the user can see the sheets being selected and then revert
> > back to the main menu.
> >
> > I was wondering if there is a way to get the code to point to the sheets H1
> > and H2 but without actually selecting it or the user seeing them being
> > selected.
> >
> > I appreciate this is purely cosmetic but it would make the front end look a
> > little better.
> >
> > Thanks in advance for your help.
> >
> > Martin

 
Reply With Quote
 
Martin
Guest
Posts: n/a
 
      31st Dec 2008
Thank you, that has rectified the problem.

Many thanks,

Martin

"Howard31" wrote:

> Hi Joel,
>
> Try The following statement at the beginning of the precedure:
> Application.ScreenUpdating = False
>
> Than at the end of the procedure set it back to True:
>
> Application.ScreenUpdating = True
>
> Hope that will help
>
> --
> A. Ch. Eirinberg
>
>
> "Joel" wrote:
>
> > Use the title of the window for this code to work like book1.xls. These
> > properties don't apply to individual worksheets.
> >
> > Sub Format()
> > Application.DisplayFullScreen = True
> > Application.CommandBars("Worksheet Menu Bar").Enabled = False
> >
> > With Windows("Main Menu")
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > With Windows("H1")
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > With Windows("H2")
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > End Sub
> >
> >
> > "Martin" wrote:
> >
> > > Hello,
> > >
> > > I have some code that formats my workbook which is below:
> > >
> > > Sub Format()
> > > Application.DisplayFullScreen = True
> > > Application.CommandBars("Worksheet Menu Bar").Enabled = False
> > >
> > > Sheets("Main Menu").Select
> > > With ActiveWindow
> > > .DisplayGridlines = False
> > > .DisplayHeadings = False
> > > .DisplayWorkbookTabs = False
> > > End With
> > >
> > > Sheets("H1").Activate
> > > With ActiveWindow
> > > .DisplayGridlines = False
> > > .DisplayHeadings = False
> > > .DisplayWorkbookTabs = False
> > > End With
> > >
> > > Sheets("H2").Activate
> > > With ActiveWindow
> > > .DisplayGridlines = False
> > > .DisplayHeadings = False
> > > .DisplayWorkbookTabs = False
> > > End With
> > >
> > > Sheets("Main Menu").Select
> > >
> > > End Sub
> > >
> > > I run this when the workbook is opened by the user and only takes a second
> > > to run however the user can see the sheets being selected and then revert
> > > back to the main menu.
> > >
> > > I was wondering if there is a way to get the code to point to the sheets H1
> > > and H2 but without actually selecting it or the user seeing them being
> > > selected.
> > >
> > > I appreciate this is purely cosmetic but it would make the front end look a
> > > little better.
> > >
> > > Thanks in advance for your help.
> > >
> > > Martin

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      31st Dec 2008
Hi Martin, You don't need the sheet references to set window attributes.
Those are part of Windows and therefore subordinate to the Application
object. Just remove all of your sheet references and it should solve your
problem.
"Martin" wrote:

> Joel,
>
> Sorry, I have tried this and the error message says script out of range.
>
> Any ideas on this?
>
> Martin
>
> "Joel" wrote:
>
> > Use the title of the window for this code to work like book1.xls. These
> > properties don't apply to individual worksheets.
> >
> > Sub Format()
> > Application.DisplayFullScreen = True
> > Application.CommandBars("Worksheet Menu Bar").Enabled = False
> >
> > With Windows("Main Menu")
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > With Windows("H1")
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > With Windows("H2")
> > .DisplayGridlines = False
> > .DisplayHeadings = False
> > .DisplayWorkbookTabs = False
> > End With
> >
> > End Sub
> >
> >
> > "Martin" wrote:
> >
> > > Hello,
> > >
> > > I have some code that formats my workbook which is below:
> > >
> > > Sub Format()
> > > Application.DisplayFullScreen = True
> > > Application.CommandBars("Worksheet Menu Bar").Enabled = False
> > >
> > > Sheets("Main Menu").Select
> > > With ActiveWindow
> > > .DisplayGridlines = False
> > > .DisplayHeadings = False
> > > .DisplayWorkbookTabs = False
> > > End With
> > >
> > > Sheets("H1").Activate
> > > With ActiveWindow
> > > .DisplayGridlines = False
> > > .DisplayHeadings = False
> > > .DisplayWorkbookTabs = False
> > > End With
> > >
> > > Sheets("H2").Activate
> > > With ActiveWindow
> > > .DisplayGridlines = False
> > > .DisplayHeadings = False
> > > .DisplayWorkbookTabs = False
> > > End With
> > >
> > > Sheets("Main Menu").Select
> > >
> > > End Sub
> > >
> > > I run this when the workbook is opened by the user and only takes a second
> > > to run however the user can see the sheets being selected and then revert
> > > back to the main menu.
> > >
> > > I was wondering if there is a way to get the code to point to the sheets H1
> > > and H2 but without actually selecting it or the user seeing them being
> > > selected.
> > >
> > > I appreciate this is purely cosmetic but it would make the front end look a
> > > little better.
> > >
> > > Thanks in advance for your help.
> > >
> > > Martin

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between 'Select' a sheet and 'Activate' a sheet RJQMAN Microsoft Excel Programming 9 30th Oct 2010 05:22 AM
Prevent code in "Sheet Activate" from running when sheet made visible from other macr Simon Lloyd Microsoft Excel Programming 10 21st Jun 2006 09:15 AM
sheet.activate nk Microsoft Excel Programming 0 8th Apr 2005 05:04 PM
Return to Current Sheet in On (sheet activate) event macro =?Utf-8?B?UGF1bCBNb2xlcw==?= Microsoft Excel Programming 1 27th Mar 2005 03:16 PM
Why wouldn't calling the Activate sub for a sheet automatically call that sheet's Worksheet_Activate() sub? Scott Lyon Microsoft Excel Programming 3 19th Aug 2003 03:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:39 PM.