Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default hiding rows using macro

Sub hideifzeros()
Dim a as Range
For Each a In Range(Cells(1,1),Cells(rows.count,1).End(xlup))
If a = 0 And a.Offset(0, 3) = 0 Then a.EntireRow.Hidden = True
Next
End Sub

column D is offset 3 from Column A.

--
Regards,
Tom Ogilvy


"Greg Stevens" wrote in message
...
Hello,

I am looking for some assistance here with a code I am trying to write for
an excel data. Here is the scenario:

I have 10 columns (A:J) with about 1000 rows. Each of those cells within
the 10 columns and 1000 rows contain numbers. We want to run a macro in
which for columns A and D, when and only if they both equal "0"then we

want
to hide that specific row and continue onto the next row and keep on

hiding
if the columns A and D both equal "zero" until the entire sheet has been
searched.

So far here is what I have but the macro is just taking the first row and
hiding regardless of values and stopping the

Sub hideifzeros()
For Each a In Selection
If a = 0 And a.Offset(0, 4) = 0 Then a.EntireRow.Hidden = True
Next
End Sub


Please assist, I would be very grateful as I am at a loss right now.


--
Greg



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
macro for hiding rows Khardy3352 New Users to Excel 4 February 11th 09 07:41 PM
How to code Macro for hiding rows Catherine Bond Excel Worksheet Functions 4 June 24th 06 10:13 AM
Hiding Rows in a VBA macro sarcher Excel Discussion (Misc queries) 1 May 15th 06 03:39 PM
Macro for hiding rows Linda Excel Discussion (Misc queries) 2 February 1st 06 09:26 PM
Macro for hiding rows Luke Excel Discussion (Misc queries) 22 December 24th 05 03:40 PM


All times are GMT +1. The time now is 12:18 PM.

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

About Us

"It's about Microsoft Excel"