Macro to hide the row if both columns E & F are blank in that row.
Hi,
I am searching for a Macro or Formula that will hide both columns E&F if they are blank in that row. Example below: A B C D E F Name Exp Rpts Account Name Account # Debit Credit __________________________________________________ __________ Nov T & L 0400011111 0.00 768.11 AAAA M & E 0400011111 78.81 Leased Auto 0400011111 Any Ideas? Thanks! Pcakes |
Macro to hide the row if both columns E & F are blank in that row.
Option Explicit
Sub testme01() Dim LastRow As Long Dim iRow As Long With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = LastRow To 2 Step -1 'headers in row 1???? If Application.CountA(.Cells(iRow, "E").Resize(1, 2)) = 0 Then .Rows(iRow).Hidden = True Else .Rows(iRow).Hidden = False 'unhide it????? End If Next iRow End With End Sub I used column A to determine the last used row on the sheet. Pcakes wrote: Hi, I am searching for a Macro or Formula that will hide both columns E&F if they are blank in that row. Example below: A B C D E F Name Exp Rpts Account Name Account # Debit Credit __________________________________________________ __________ Nov T & L 0400011111 0.00 768.11 AAAA M & E 0400011111 78.81 Leased Auto 0400011111 Any Ideas? Thanks! Pcakes -- Dave Peterson |
Macro to hide the row if both columns E & F are blank in that
Worked like a charm, thanks!
"Dave Peterson" wrote: Option Explicit Sub testme01() Dim LastRow As Long Dim iRow As Long With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = LastRow To 2 Step -1 'headers in row 1???? If Application.CountA(.Cells(iRow, "E").Resize(1, 2)) = 0 Then .Rows(iRow).Hidden = True Else .Rows(iRow).Hidden = False 'unhide it????? End If Next iRow End With End Sub I used column A to determine the last used row on the sheet. Pcakes wrote: Hi, I am searching for a Macro or Formula that will hide both columns E&F if they are blank in that row. Example below: A B C D E F Name Exp Rpts Account Name Account # Debit Credit __________________________________________________ __________ Nov T & L 0400011111 0.00 768.11 AAAA M & E 0400011111 78.81 Leased Auto 0400011111 Any Ideas? Thanks! Pcakes -- Dave Peterson |
All times are GMT +1. The time now is 10:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com