Consulting

Results 1 to 2 of 2

Thread: row and column headers

  1. #1
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location

    row and column headers

    I have created a hidden button that hides / shows (toggles) the menu and toolbars so that I can edit the file when I need to. I would like to toggle the row and column headers to but I can't seem to make it work. This is what I was trying to do:

    [VBA]dim MyTabs as worksheets

    for each MyTabs in workbook
    MyTabs.DisplayHeadings = false
    next MyTabs[/VBA]

    I get an Object Required error.

    What am I doing wrong?
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  2. #2
    Hi
    I think this only works for the active window.

    Try something like this to toggle the headings on/off

    [vba]Sub myHeaders()
    Dim mySheet As Worksheet
    Dim myStart As Worksheet

    Set myStart = ActiveSheet

    Application.ScreenUpdating = False

    For Each mySheet In Worksheets
    mySheet.Activate
    ActiveWindow.DisplayHeadings = Not ActiveWindow.DisplayHeadings
    Next

    myStart.Activate

    Application.ScreenUpdating = True
    End Sub[/vba]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •