Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Mpls, Minnesota, USA
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hide Columns (Excel 97 SR2)

    I have written a macro (BestFindCities - shortcut Ctrl z) that is supposed to analyze the contents of cells in a row.
    If the cell contains a 0 (zero), the macro hides the column and checks the cell to the right.
    If the cell contains a value other than 0 (zero), the macro leaves the column visible and checks the cell to the right.
    If cell contains a blank, the macro makes the cell in column B, of same row, the active cell and stops.
    The macro must be in column B when you run it.
    You can tell if it worked -The active cell is in column B and the only visible City columns have a value.
    A second macro (ShowAll shortcut - Ctrl q) makes all columns on sheet visible.

    Problem is it works on some rows and not others. I have cut much of the workbook (and worksheet) away to reduce size, and have attached it.

    The rows that fail have an orange background in column A (meter name). The active cell is one of the columns to the far right and not all columns are hidden that should be.

    Does anyone have time to look into it?

    Thanks,
    Chuck Reimer
    I'm from the Government and I'm here to help...

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Columns (Excel 97 SR2)

    You have a number of comments in the cells in row 2 of the worksheet. There is a bug in XL97 (also apparently in 2000) that can cause a column hide to fail if there is a comment in a cell in a column to its right. See Here Your On Error statement is masking the error so that you don't see it happen. If I remove all of the comments in row 2, your code seems to work correctly.
    Legare Coleman

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Mpls, Minnesota, USA
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Columns (Excel 97 SR2)

    Legare,
    Thank you very much.
    That is a very strange error. Rather hit-or-miss.
    I will fix it.
    Sorry about my "masking" the error with On Error.

    Thanks again,
    Chuck
    Chuck Reimer
    I'm from the Government and I'm here to help...

Posting Permissions

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