Results 1 to 2 of 2

Thread: VBA to hide the rows in Microsoft Excel

  1. #1
    Join Date
    Dec 2011
    Posts
    59

    VBA to hide the rows in Microsoft Excel

    I am new to Excel and VBA. I am trying to hide rows based on whether the user enters a specific word(s)/phrase into a specific cell. For example, if cell M49 has a value of "i love lucy", then unhide rows 50 through 55, if cell M49 is empty or has any other value than "i love lucy", then hide the rows. How do I implement that? So if you guys have any information or any ideas for this then please let me know.

  2. #2
    Join Date
    Aug 2011
    Posts
    540

    Re: VBA to hide the rows in Microsoft Excel

    According to my information you should try the below code.
    Code:
    ' Sheet 1 Class Module
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("M49")) Is Nothing Then Exit Sub
    If LCase(Range("M49").Value) = "i love lucy" Then
    Range("A50:A55").EntireRow.Hidden = False
    Else
    Range("A50:A55").EntireRow.Hidden = True
    End If
    End Sub

Similar Threads

  1. Want help to create roll up rows in Microsoft Excel
    By Ambition in forum MS Office Support
    Replies: 2
    Last Post: 24-02-2012, 07:21 PM
  2. How to create fixed lengh cell and rows in Microsoft Excel
    By Henriksen in forum MS Office Support
    Replies: 2
    Last Post: 21-02-2012, 05:52 PM
  3. Replies: 2
    Last Post: 18-01-2012, 06:55 PM
  4. Replies: 2
    Last Post: 09-07-2009, 08:57 AM
  5. Auto hide rows and column in Excel 2007
    By Murena in forum Windows Software
    Replies: 3
    Last Post: 28-02-2009, 07:00 PM

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
  •  
Page generated in 1,713,540,883.41682 seconds with 18 queries