+ Reply to Thread
Results 1 to 13 of 13

How can I hide rows and retain row numbers?

  1. #1
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    How can I hide rows and retain row numbers?

    I'm using the code below to hide blank rows but I'm also hiding the row numbers.
    Is there a way to hide the rows and retain the row numbers, counting from the bottom up perhaps?
    Any advice is much appreciated.

    Please Login or Register  to view this content.
    Last edited by Mayweed; 03-21-2011 at 06:17 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: How can I hide rows and retain row numbers?

    Hi

    You could always insert a new column A and have the formula
    =SUBTOTAL(103,$B$2:B2)
    copied down the the range

    You could do this y as part of your existing code.
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  3. #3
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    Re: How can I hide rows and retain row numbers?

    Roger,
    Thank you for the reply but I can't see how that can work, I've attached a workbook if you have time to demonstrate your technique but I would prefer to have the rows hidden with VB if possible.
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How can I hide rows and retain row numbers?

    Do you mean the grey numbers at the side? If you do then hiding rows will hide these numbers, no way to avoid it
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    Re: How can I hide rows and retain row numbers?

    Hi Roy,
    Yes I meant the grey numbers, thanks for the answer.
    The code seems to be slow with screen flicker for some reason, if I use delete rows it removes the screen flicker but takes longer to execute.
    The code I'm using was originally written in part by you in reply to one of my posts some time ago, would you mind looking over it to see if there is any way to streamline it at all?

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How can I hide rows and retain row numbers?

    Have you tried to turn off some of excel's functionality, if screen flicker is part of the problem:

    Please Login or Register  to view this content.
    abousetta

  7. #7
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    Re: How can I hide rows and retain row numbers?

    Hi Abousetta,
    Thank you for the code, I was only using 'ScreenUpdating false' but even your code dosen't stop the flicker or speed problem.
    Perhaps I'm trying to hide too many rows at once, I've decided to cut the rows down to 500 and delete them; it would seem that deleting rather than hiding, stops the screen flicker.
    Thanks again.

  8. #8
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: How can I hide rows and retain row numbers?

    Hi

    I thought you just wanted to show a row number for each visible row.
    If you want to Not Show the actual row numbers, then you would have to Hide headings.

    The attached workbook shows you how.
    Attached Files Attached Files

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

    Re: How can I hide rows and retain row numbers?

    Hello Mayweed,

    I don't experience the same problem on my system, but there are a number of factors that contribute to screen flicker. One of which is switching between tasks. When VBA executes it tends to "hog'" the system. Using DoEvents can sometimes smooth out the process. I have added that to your here. Give it a try, it may help.
    Please Login or Register  to view this content.
    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!)

  10. #10
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    Re: How can I hide rows and retain row numbers?

    Hi Leith,
    Thanks for the code, it works! I scattered a few 'DoEvents' here and there and the screen flicker has disappeared.
    Last edited by Mayweed; 03-22-2011 at 05:35 AM. Reason: No one answered the question concerning streamlining code

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How can I hide rows and retain row numbers?

    This will toggle visibility
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    Re: How can I hide rows and retain row numbers?

    Roy, that helps a lot with my 'hide rows/retain numbers' problem, thank you.

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How can I hide rows and retain row numbers?

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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