Results 1 to 6 of 6

hide/unhide macro

Threaded 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.

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