Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need a macro to hide certain columns Dallman Ross Excel Discussion (Misc queries) 12 October 19th 06 05:58 PM
Macro to Split Window in Same Place Even If Columns Added or Hidde PBJ Excel Discussion (Misc queries) 0 September 28th 06 03:06 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
macro to hide columns Shooter Excel Worksheet Functions 2 September 27th 05 09:04 PM
how can hide and show columns using macro? Hoshyar Excel Worksheet Functions 4 September 2nd 05 03:45 PM


All times are GMT +1. The time now is 08:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"