+ Reply to Thread
Results 1 to 6 of 6

hide/unhide macro

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    hide/unhide macro

    I am trying to create a macro what will hide the rows that are blank when the column I11:I28 is blank. I have a macro started that will hide the cells when the button is selected but if I select the button again I want the hidden cells to be unhidden.
    Below is the macro that I am currently using just need to add the unhide function when the macro button is selected.
    Any help would be greatly appreciated

    Sub Hide_me()
    Dim MyRange, MyRange1 As Range
    LastRow = Cells(Rows.Count, "I").End(xlUp).Row
    Set MyRange = Range("I11:I28")
    For Each c In MyRange
    If IsEmpty(c) Then
    If MyRange1 Is Nothing Then
    Set MyRange1 = c.EntireRow
    Else
    Set MyRange1 = Union(MyRange1, c.EntireRow)
    End If
    End If
    Next
    If Not MyRange1 Is Nothing Then
    MyRange1.EntireRow.Hidden = True
    End If
    End Sub
    Last edited by aaron061883; 03-30-2013 at 06:40 PM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: hide/unhide macro

    Pls take few minutes to read the forum rules, because:

    Your post does not comply with rule 3 of our forum. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

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

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: hide/unhide macro

    post has been made compliant

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: hide/unhide macro

    Yes and thank you for this. We appreciate it.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: hide/unhide macro

    hi aaron061883, option
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: hide/unhide macro

    that is perfect thank you very much I truly do appreciate the help

+ 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