Hiding rows based on cell content
I am looking to hide a row in a worksheet where the column o contain
the value false.This sounds easy but just cant get my head round it -- Message posted from http://www.ExcelForum.com |
Hiding rows based on cell content
try this simple code:
Option Explicit Sub test() delete_row Selection End Sub Sub delete_row(target As Range) If target.Value = "False" Then Rows(target.Row).Delete End If End Sub Patrick Molloy Microsoft Excel MVP -----Original Message----- I am looking to hide a row in a worksheet where the column o contains the value false.This sounds easy but just cant get my head round it. --- Message posted from http://www.ExcelForum.com/ . |
Hiding rows based on cell content
A possible modification
Option Explicit Sub test() Dim rw As Range With ActiveSheet For Each rw In Intersect(.Columns("O"), .UsedRange) Hide_row rw Next End With End Sub Sub Hide_row(target As Range) If Not IsEmpty(target) Then If target.Value = False Then Rows(target.Row).EntireRow.Hidden = True Else Rows(target.Row).EntireRow.Hidden = False End If End If End Sub -- Regards, Tom Ogilvy "Patrick Molloy" wrote in message ... try this simple code: Option Explicit Sub test() delete_row Selection End Sub Sub delete_row(target As Range) If target.Value = "False" Then Rows(target.Row).Delete End If End Sub Patrick Molloy Microsoft Excel MVP -----Original Message----- I am looking to hide a row in a worksheet where the column o contains the value false.This sounds easy but just cant get my head round it. --- Message posted from http://www.ExcelForum.com/ . |
All times are GMT +1. The time now is 09:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com