+ Reply to Thread
Results 1 to 7 of 7

unhide row simultaneously

  1. #1
    Registered User
    Join Date
    09-13-2008
    Location
    Australia
    Posts
    8

    unhide row simultaneously

    Hi guys,

    I have a simple code for hiding rows when the value in column I is 0. however i want it to unhide the next row when data is entered in the current row. so if for example row 3 is the last unhiden row at the moment, row 4 will unhide once i enter data in row 3. i currently have row G set to show 1 when the current row has data and for rows i permanently want displayed, and column H set to show a 1 when the previous row has row has data, and zero if it does not.

    The code works but not as i am entering data... it only updates (unhides rows if i go to another sheet and then come back again). Any ideas on how to get it to update as i enter data in rows??


    Thnx in advance

  2. #2
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,

    Try using a selection change macro eg:

    Please Login or Register  to view this content.
    It's often helpful if you post your existing code with the question. If my suggestion doesn't help (or even if it does), can you please post your existing code to help people make more informed suggestions/improvements?

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  3. #3
    Registered User
    Join Date
    09-13-2008
    Location
    Australia
    Posts
    8
    Hi Rob,

    thnx for the help. but i'm not to sure what u mean with the selection change macro... sorry i'm a novice at macros. One other thing i have noticed is that the macro takes a while to update (like 10 secs) is this normal or could i be doing something wrong. i have pasted the code into the appropriate sheet in Visual Basic. Should i be posting it into one of the modules?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,
    Sorry, this reply may leave more questions than answers as I'm off to bed now - I'll check this thread out again tomorrow...

    1) You can delete "Private Sub Worksheet_Activate()" & replace it with "Private Sub Worksheet_Change(ByVal Target As Range)". This is slightly different than what I previously suggested & will run each time you change something on the sheet. Although, you may find the 10 second time (effectively caused by the 1-1000 repetition/loop) is way too long when used in this way.
    Recording this in the sheet code is appropriate because the actions of the macro relate to what happens on the specific sheet.

    2) To help with the speed I suggest using a different approach which involves the use use of autofiltering rather than looping. I have included a commented section which could be uncommented & used for clearing any active filters before making these changes.

    Please Login or Register  to view this content.
    hth
    Rob

  5. #5
    Registered User
    Join Date
    09-13-2008
    Location
    Australia
    Posts
    8
    Thnx for that Rob,

    i had tried the selection change macro at just before your last post, and although it update the spreadsheet as i enetred data, it virtually made it unusable with the sheet taking 10-25 seconds to update after every line.

    i will try your suggestion later today and post back the outcome.

    thnx

  6. #6
    Registered User
    Join Date
    09-13-2008
    Location
    Australia
    Posts
    8
    thanx v much. It worked a treat.... much appreciated.

  7. #7
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    Pleased I could help - thanks for the feedback :-)

    btw, I forgot to mention this in my last post...
    It's been recommended to me in the past that it is better if function code is put in a normal module & only macros for the sheet are included in the Sheet object in the VBE.

    Rob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Command Button to unhide rows
    By earl54dink in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 04-30-2008, 12:11 PM
  2. UnHide Sheets in Order
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2008, 07:34 PM
  3. Unhide rows thru an event
    By WhiteKelso in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-23-2007, 12:54 PM
  4. Replies: 0
    Last Post: 10-02-2007, 06:41 PM
  5. Unhide 1 specific hidden column
    By Frustr8ed! in forum Excel General
    Replies: 2
    Last Post: 03-06-2007, 04:52 AM

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