+ Reply to Thread
Results 1 to 7 of 7

VBA Unhiding Rows Bugs...

  1. #1
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    VBA Unhiding Rows Bugs...

    Hi All,

    Yet another post from me! Got a bug in my VBA that doesn't seem to make sense.

    I have three drop downs calling three simple functions, but the problem is this:
    Please Login or Register  to view this content.
    This works fine and reveals only rows 31 to 43, but change the numbers and it all goes wrong:
    Please Login or Register  to view this content.
    This is unhiding rows 7 to 28 - Am I missing something here? If I change the numbers to 31:43, it just unhides 31 to 43.

    Likewise, the final script, though being set to 19:31 is bringing in 18 to 31. I can't figure this out and I'm wondering if I'm missing the blindingly obvious?

    Thanks
    Last edited by V8Maverick; 07-28-2010 at 07:55 AM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: VBA Unhiding Rows Bugs...

    Not sure that I understand what you are syaing, but try simpliying it and removing all of the selecting

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VBA Unhiding Rows Bugs...

    Do you have merged cells or anything like that covering the areas that are wrongly being unhidden?

    A sample workbook where it's not working right would probably help to suss out where the issue is.

    For info you never really need to use select with vba. You code can be written like this:

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  4. #4
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    Re: VBA Unhiding Rows Bugs...

    I've got a text box floating about to the right, but it's set not to size or move with the cells. I'll cut the relevent worksheets out and post here so that you can see what is (or isn't) happening.

  5. #5
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    Re: VBA Unhiding Rows Bugs...

    Here is the sample sheets. Selecting Yes, or No to the Michelin / BFGoodrich / Kormoran actions in "CUST_DETAIL" should unhide the historic sales boxes for their brand in "AMP&LY"
    Michelin: Rows 7:18
    BFGoodrich: Rows 19:31
    Kormoran: Rows 31:43

    I'm sure now that someone is going to point out that I am missing the bleeding obvious, but hey ho. It's driving me mad.

    EDIT: Attachment removed as initial problem solved
    Last edited by V8Maverick; 07-28-2010 at 07:52 AM.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Unhiding Rows Bugs...

    Hello V8Maverick,

    I named a range for each manufacturer "Michelin", "BFGoodrich", "Kormoran" to make hiding and displaying the ranges easier. Here is code now...
    Please Login or Register  to view this content.

    The attached workbook contains these changes.
    Last edited by Leith Ross; 07-28-2010 at 11:40 AM.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    03-16-2009
    Location
    Essex, England
    MS-Off Ver
    Excel XP, 2003 & 2010
    Posts
    30

    Re: VBA Unhiding Rows Bugs...

    Okay, those named ranges seem to have done the trick - Though they only seem to point to the rows I was previously asking to hide by number rather than name. Oh well, another brain bender put to bed. Thanks!

    Any idea what may have been causing the initial problem?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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