+ Reply to Thread
Results 1 to 5 of 5

Can't unhide rows in separate worksheets

  1. #1
    Registered User
    Join Date
    11-28-2005
    Location
    Saint Louis, Missouri USA
    MS-Off Ver
    2016
    Posts
    69

    Can't unhide rows in separate worksheets

    I have a workbook I use at work for putting together bids for our products and services. My estimation worksheet has 40 potential product item rows, each of which have a corresponding row on the bid worksheet (what the customer sees). I keep all but the first ten rows on the estimation sheet hidden initially, but when you fill in the 10th row, the 11th row unhides itself via VBA, and this continues until the last of the 40 rows is visible. (Up until now, I never did any hidden rows on the bid sheet; all 40 rows were always visible, I would just later manually delete rows I did not use.)

    This code has worked flawlessly for years, but today, I tried to add a line to unhide the corresponding row in the bid worksheet. (I use a variable for the row number on the estimation sheet, HideRow, and one for the bid sheet, HideBRow, along with the Rows property, for the connection between the "source" row in the estimation sheet and the "destination" row in the bid sheet. They don't line up exactly, there's an offset of 15 rows between them.)

    I am sure this is something academic, like I am trying to call a variable outside of the scope I'm in, but I tried this in the estimation sheet, or the ThisWorkbook module, and the part that always worked before continues to work but I can't do anything to the bid sheet. Here is the code. Thank you in advance for your help!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Can't unhide rows in separate worksheets

    Is the Bid sheet the 20th worksheet? You can also reference the sheets by tab name e.g.; Sheets("Bid")

  3. #3
    Registered User
    Join Date
    11-28-2005
    Location
    Saint Louis, Missouri USA
    MS-Off Ver
    2016
    Posts
    69

    Re: Can't unhide rows in separate worksheets

    Quote Originally Posted by AlphaFrog View Post
    Is the Bid sheet the 20th worksheet? You can also reference the sheets by tab name e.g.; Sheets("Bid")
    Yes, Sheet2 is the estimation/source, Sheet20 is the bid/destination sheet. For laughs, I referenced them by name, too; no change.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Can't unhide rows in separate worksheets

    As a test, does this select the Bid sheet and the correct row?

    Application.GoTo ActiveWorkbook.Sheets(20).Rows(HideBRow)

  5. #5
    Registered User
    Join Date
    11-28-2005
    Location
    Saint Louis, Missouri USA
    MS-Off Ver
    2016
    Posts
    69

    Re: Can't unhide rows in separate worksheets

    No. "Method of 'Goto' of Object '_Application failed" error message.

    But... after tinkering with this some, I tried to activate the sheet (because I had some suspicion the sheet had to be active for what I was trying to do), and my Sheet20 reference was somehow activating Sheet13. I still can't explain that, but when I changed to using the the sheet name, per your earlier advice, it worked like a champ. I know I had tried that earlier and it didn't work, but I think I was working with a different approach otherwise.

    Thanks!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1