+ Reply to Thread
Results 1 to 6 of 6

Need Macro to Auto hide rows

Hybrid View

  1. #1
    Registered User
    Join Date
    01-23-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    3

    Need Macro to Auto hide rows

    Hello,

    I am trying to write a macro that will hide the row that "Complete" is selected in. So in column "M" cells there is a drop down that has the options Complete, Not Complete and Follow-up. I want the row that is completed to hide when "Complete" is chosen. Everything I have done has failed. I am using excel 2010.

    Thanks for your help, I need it.

  2. #2
    Registered User
    Join Date
    01-23-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Need Macro to Auto hide rows

    I tired this but when I hit run, its acting like I don
    Private Sub Worksheet_Change(ByVal Target As Range)
    
       Dim myrange As Range
      Set myrange = Range("M:M")
       For Each cell In myrange
       If cell <> "" Then
       If cell.Value = "Complete" Then
        cell.EntireRow.Hidden = True
        End If
        End If
        Next cell
    
    End Sub
    Last edited by arlu1201; 01-24-2013 at 12:26 AM.

  3. #3
    Registered User
    Join Date
    01-23-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Need Macro to Auto hide rows

    This seems to work but I have to run it for it to hide the completed. It doesn't do it in real time
    Sub Macro1()
       
       Dim myrange As Range
      Set myrange = Range("M:M")
       For Each cell In myrange
       If cell <> "" Then
       If cell.Value = "Complete" Then
        cell.EntireRow.Hidden = True
        End If
        End If
        Next cell
    
    End Sub
    Last edited by arlu1201; 01-24-2013 at 12:26 AM.

  4. #4
    Registered User
    Join Date
    08-22-2012
    Location
    Bhubaneswar
    MS-Off Ver
    Excel 2003,2007
    Posts
    95

    Re: Need Macro to Auto hide rows

    @cmwood

    Hi

    Try to put the code in the Sheet which sheet you want to run the above code and also your first code also working


    Private Sub Worksheet_Change(ByVal Target As Range)
    Call Macro1
    End Sub
    Hope it clear

    Thanks

    SP
    Last edited by Patnaik; 01-24-2013 at 12:54 AM. Reason: Add extra MSG

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need Macro to Auto hide rows

    CMWood,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need Macro to Auto hide rows

    Try this code
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 13 Then
        If Target.Value = "Complete" Then
            Target.EntireRow.Hidden = True
        End If
    End If
    End Sub

+ 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