Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default VBA to hide headers

I have a working file with more than 50 sheets. When I send out to my users I
would like to hide both the row and columns headers in every sheets. Can
someone help?

I am using the below to copy and paste values in every sheet and it worked
very well. Not sure if some coding can be added inside the loop.

Set WB = ActiveWorkbook
For Each SH In WB.Worksheets
With SH.UsedRange
.Value = .Value
End With
Next SH




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default VBA to hide headers

Try something like the following -

Sub test()
Dim ws As Worksheet
Dim wn As Window

On Error Resume Next
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
For Each wn In ActiveWorkbook.Windows
wn.DisplayHeadings = False
Next
Next

End Sub

Usually it's not necessary to use select or activate, though in the case of
window properties normally need to activate the sheet.. Above caters for
possibility of multiple windows per sheet and the error handler in case a
worksheet chart is active.

Regards,
Peter T

"C02C04" wrote in message
...
I have a working file with more than 50 sheets. When I send out to my

users I
would like to hide both the row and columns headers in every sheets. Can
someone help?

I am using the below to copy and paste values in every sheet and it worked
very well. Not sure if some coding can be added inside the loop.

Set WB = ActiveWorkbook
For Each SH In WB.Worksheets
With SH.UsedRange
.Value = .Value
End With
Next SH






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default VBA to hide headers

I know this is probably a case where you'd prefer to do this through code,
but I would also suggest looking into Bastien Mensink's ASAP-Utilities, a
free add-in that includes a "Vision Control" macro to do just this, even
across multiple sheets. Oh, and there are also 299 other really cool macros.
Check it out at asap-utilities.com

Pflugs

"Peter T" wrote:

Try something like the following -

Sub test()
Dim ws As Worksheet
Dim wn As Window

On Error Resume Next
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
For Each wn In ActiveWorkbook.Windows
wn.DisplayHeadings = False
Next
Next

End Sub

Usually it's not necessary to use select or activate, though in the case of
window properties normally need to activate the sheet.. Above caters for
possibility of multiple windows per sheet and the error handler in case a
worksheet chart is active.

Regards,
Peter T

"C02C04" wrote in message
...
I have a working file with more than 50 sheets. When I send out to my

users I
would like to hide both the row and columns headers in every sheets. Can
someone help?

I am using the below to copy and paste values in every sheet and it worked
very well. Not sure if some coding can be added inside the loop.

Set WB = ActiveWorkbook
For Each SH In WB.Worksheets
With SH.UsedRange
.Value = .Value
End With
Next SH







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default VBA to hide headers

Excellent! Works perfectly!
Thanks Peter.

"Peter T" wrote:

Try something like the following -

Sub test()
Dim ws As Worksheet
Dim wn As Window

On Error Resume Next
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
For Each wn In ActiveWorkbook.Windows
wn.DisplayHeadings = False
Next
Next

End Sub

Usually it's not necessary to use select or activate, though in the case of
window properties normally need to activate the sheet.. Above caters for
possibility of multiple windows per sheet and the error handler in case a
worksheet chart is active.

Regards,
Peter T

"C02C04" wrote in message
...
I have a working file with more than 50 sheets. When I send out to my

users I
would like to hide both the row and columns headers in every sheets. Can
someone help?

I am using the below to copy and paste values in every sheet and it worked
very well. Not sure if some coding can be added inside the loop.

Set WB = ActiveWorkbook
For Each SH In WB.Worksheets
With SH.UsedRange
.Value = .Value
End With
Next SH







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default VBA to hide headers

Thanks! I didn't know about this.

"Pflugs" wrote:

I know this is probably a case where you'd prefer to do this through code,
but I would also suggest looking into Bastien Mensink's ASAP-Utilities, a
free add-in that includes a "Vision Control" macro to do just this, even
across multiple sheets. Oh, and there are also 299 other really cool macros.
Check it out at asap-utilities.com

Pflugs

"Peter T" wrote:

Try something like the following -

Sub test()
Dim ws As Worksheet
Dim wn As Window

On Error Resume Next
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
For Each wn In ActiveWorkbook.Windows
wn.DisplayHeadings = False
Next
Next

End Sub

Usually it's not necessary to use select or activate, though in the case of
window properties normally need to activate the sheet.. Above caters for
possibility of multiple windows per sheet and the error handler in case a
worksheet chart is active.

Regards,
Peter T

"C02C04" wrote in message
...
I have a working file with more than 50 sheets. When I send out to my

users I
would like to hide both the row and columns headers in every sheets. Can
someone help?

I am using the below to copy and paste values in every sheet and it worked
very well. Not sure if some coding can be added inside the loop.

Set WB = ActiveWorkbook
For Each SH In WB.Worksheets
With SH.UsedRange
.Value = .Value
End With
Next SH







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
Hide or Protect Headers RLD Excel Discussion (Misc queries) 2 March 15th 10 03:15 PM
How to Hide Row & Column Headers in Excel ? Irfan Khan[_2_] Excel Discussion (Misc queries) 3 November 2nd 07 02:44 PM
Hide Column Headers but not row (Headers) Kevan Gradwell Excel Programming 1 March 16th 07 05:59 PM
Show/Hide Column and Row Headers graz Excel Discussion (Misc queries) 2 September 29th 05 01:37 AM
Possible to hide column headers??? T-®ex[_53_] Excel Programming 4 September 3rd 05 01:37 AM


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