PC Review


Reply
Thread Tools Rate Thread

DisplayHeadings

 
 
Sandy
Guest
Posts: n/a
 
      22nd Mar 2008
I have the following which loops through 19 Worksheets :-

For Each Wksht In Worksheets
With Application
.DisplayFullScreen = False
.DisplayFormulaBar = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.CommandBars("Drawing").Visible = True
End With
Next

For Each Wksht In Worksheets
Wksht.Activate
ActiveWindow.DisplayHeadings = True
Next

however I only require it to loop through 7 sheets - say sheets "A" thro
"G". How can I change the above to do that?

Thanks
Sandy

 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      22nd Mar 2008
The code you are using is not worksheet specific. That is, the settings are
part of the Windows attributes and will apply to everything in the workbook.
You don't even need to loop through the sheets. The following will set the
attributes for the current instance of Excel for whichever workbooks you open
until you reset them.

With Application
.DisplayFullScreen = False
.DisplayFormulaBar = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.CommandBars("Drawing").Visible = True
End With
ActiveWindow.DisplayHeadings = True





"Sandy" wrote:

> I have the following which loops through 19 Worksheets :-
>
> For Each Wksht In Worksheets
> With Application
> .DisplayFullScreen = False
> .DisplayFormulaBar = True
> .CommandBars("Worksheet Menu Bar").Enabled = True
> .CommandBars("Standard").Visible = True
> .CommandBars("Formatting").Visible = True
> .CommandBars("Drawing").Visible = True
> End With
> Next
>
> For Each Wksht In Worksheets
> Wksht.Activate
> ActiveWindow.DisplayHeadings = True
> Next
>
> however I only require it to loop through 7 sheets - say sheets "A" thro
> "G". How can I change the above to do that?
>
> Thanks
> Sandy
>

 
Reply With Quote
 
Malik
Guest
Posts: n/a
 
      31st Mar 2008
This one you can try:

Public Sub MySheetHeadings()
With Application
.DisplayFullScreen = False
.DisplayFormulaBar = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Standard").Visible = True
.CommandBars("Formatting").Visible = True
.CommandBars("Drawing").Visible = True
End With

Dim oRange As Excel.Range
Dim RowCount As Long
' MySheetList is a named range where you can keep teh required worksheets
' name
Set oRange = ThisWorkbook.Names("MySheetList").RefersToRange
For RowCount = 1 To oRange.Rows.Count
If oRange.Cells(RowCount, 1).Value = "" Then
Exit For
Else
ThisWorkbook.Worksheets(oRange.Cells(RowCount, 1).Value).Activate
ActiveWindow.DisplayHeadings = True
End If
Next RowCount
End Sub


--
Malik


"Sandy" wrote:

> I have the following which loops through 19 Worksheets :-
>
> For Each Wksht In Worksheets
> With Application
> .DisplayFullScreen = False
> .DisplayFormulaBar = True
> .CommandBars("Worksheet Menu Bar").Enabled = True
> .CommandBars("Standard").Visible = True
> .CommandBars("Formatting").Visible = True
> .CommandBars("Drawing").Visible = True
> End With
> Next
>
> For Each Wksht In Worksheets
> Wksht.Activate
> ActiveWindow.DisplayHeadings = True
> Next
>
> however I only require it to loop through 7 sheets - say sheets "A" thro
> "G". How can I change the above to do that?
>
> Thanks
> Sandy
>

 
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
DisplayHeadings Sandy Microsoft Excel Programming 7 16th Jul 2007 06:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:18 AM.