Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2003
    Posts
    40

    Question Unanswered: Unhiding rows with a button

    How can I unhide rows using a button??
    I appreciate any help I can get.

  2. #2
    Join Date
    Oct 2003
    Posts
    1,091
    It is a two step process.

    1. Record a macro in which you unhide the rows you want, be sure to name the macro. (If you need more help, post back) If you want this macro for any worksheet you want, be sure that when you record, you record it in the Personal.xls, not in "This Workbook"). At the end, when you exit Excel completely, it will ask if you want to save the changes to Personal.xls. Click OK/Yes. Now, it will be available for any worksheet you want.

    2. You can set up a button in several ways. Here are three. If you are new, I would suggest the first one.

    a. (recommended) Right-click a toolbar, and choose "Customize". Then on the middle tab it should list on the left side all of the menu options, scroll down to Macros, click, and then on the right side you should see two items. Click and drag the first one up to a toolbar. When the line turns thick black, then release the mouse. There should be a button on the toolbar. With the customize dialog box still open, right-click on the new button, and select "Assign macro" - you will see your new macro listed. Click on it, then OK. While the customize dialog box is still open, right-click again, and go to the name, and type in the name you want (i.e. HideRows).

    b. Perhaps the easiest is to use a command button on the Forms toolbar (View > Toolbars > Forms). Click the command button, then draw the button as you want. You can resize later. Once that is drawn, then right-click on that button, and go to "Assign macro". When you release the mouse, a dialog box appears that will list the macros available. You should see your new recorded macro listed. Click on it, then Click OK. You can move the button anywhere and resize.

    c. Instead of the Forms toolbar, use the Control toolbar. This time, you have to click the design button, then the command button and draw it. This time assigning a macro is more difficult, but you have more format options for the button. (I can give you more if you decide to go this route).


    Now, back on the spreadsheet, hide the rows that you wanted, then test the button, either on the toolbar, or with the command button. I usually try it several times.
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  3. #3
    Join Date
    Nov 2003
    Posts
    40
    I know how to make a button and assign the macro and all that stuff. I just don't know what the code is to unhide the rows.

  4. #4
    Join Date
    Oct 2003
    Posts
    1,091
    Best way to learn is to turn on the macro recorder, unhide the rows, stop the recorder, then press ALT + F11 and look at the code that was recorded.
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  5. #5
    Join Date
    Oct 2003
    Posts
    1,091
    If you try the recorder you will get what you want, but it can be more than is needed.

    Here is a one line code:

    Code:
    Sub UnHideRows()
        Rows("18:21").EntireRow.Hidden = False
    End Sub
    Change your row numbers appropriately.
    Last edited by shades; 12-04-03 at 12:51.
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  6. #6
    Join Date
    Nov 2003
    Posts
    40

    Talking

    That is all I needed. Thanks!!

  7. #7
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188
    can be done with a builtin excel tool as well. goto view - custom views

    hope this helps
    qha_vn

Posting Permissions

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