Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need a macro to hide certain columns | Excel Discussion (Misc queries) | |||
Macro to Split Window in Same Place Even If Columns Added or Hidde | Excel Discussion (Misc queries) | |||
checking that cells have a value before the workbook will close | Excel Worksheet Functions | |||
macro to hide columns | Excel Worksheet Functions | |||
how can hide and show columns using macro? | Excel Worksheet Functions |