Private Sub hideHeadings()
Dim obj As Window
For Each obj In Application.Windows
obj.DisplayHeadings = False
Next obj
End Sub
The above is my attempt, as when I recorded code to do it it goes ActiveWindow.DisplayHeadings = false. But I must be missing something. Please help thanks in advance.
I think there is nothing you can do with that except iterating on each worksheet. I succeed with this code
Private Sub hideHeadings()
Dim wrkbk As Workbook
Dim wrksh As Worksheet
Dim prev As Window
Set prev = ActiveWindow
For Each wrkbk In Workbooks
For Each wrksh In wrkbk.Worksheets
wrksh.Activate
ActiveWindow.DisplayHeadings = False
Next wrksh
Next wrkbk
prev.Activate
End Sub
Or in short:
Sub HideShowRowColumnHeaders()
ActiveWindow.DisplayHeadings = Not ActiveWindow.DisplayHeadings
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With