#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ted
 
Posts: n/a
Default Makro in excel

Hi!
I want to make a macro that hides the hole row if a cell in that row has the
value 0 (zero).
Dont know how to do that.
Can anyone help me with a tip how to accomplish this.
:)
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Makro in excel

Any cell?

Rows(5).Hidden = Application.Countif(Rows(5),0) 0

or a specific cell?

Rows(5).Hidden = Range("M5") .value = 0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
Hi!
I want to make a macro that hides the hole row if a cell in that row has

the
value 0 (zero).
Dont know how to do that.
Can anyone help me with a tip how to accomplish this.
:)



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ted
 
Posts: n/a
Default Makro in excel

I want the macro to go thru the hole worksheet row by row.
If the cell e3,e4 and so on are zero the row should be hidden.

"Bob Phillips" skrev:

Any cell?

Rows(5).Hidden = Application.Countif(Rows(5),0) 0

or a specific cell?

Rows(5).Hidden = Range("M5") .value = 0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
Hi!
I want to make a macro that hides the hole row if a cell in that row has

the
value 0 (zero).
Dont know how to do that.
Can anyone help me with a tip how to accomplish this.
:)




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stefi
 
Posts: n/a
Default Makro in excel

Hi Ted,

Try this:

Sub hiderow()
Dim whichrng As Range
Set whichrng = Range("A1:A10") 'adjust range to your needs!
For Each cell In whichrng
If cell = 0 And Not IsEmpty(cell) Then
Rows(cell.Row).Hidden = True
End If
Next cell
End Sub

Regards,
Srefi

€˛Ted€¯ ezt Ć*rta:

Hi!
I want to make a macro that hides the hole row if a cell in that row has the
value 0 (zero).
Dont know how to do that.
Can anyone help me with a tip how to accomplish this.
:)

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Makro in excel


For i = 1 To Cells(Rows.Count,"E").End(xlUp).Row
Rows(i).Hidden = Cells(i,"E").Value = 0
Next i

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
I want the macro to go thru the hole worksheet row by row.
If the cell e3,e4 and so on are zero the row should be hidden.

"Bob Phillips" skrev:

Any cell?

Rows(5).Hidden = Application.Countif(Rows(5),0) 0

or a specific cell?

Rows(5).Hidden = Range("M5") .value = 0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
Hi!
I want to make a macro that hides the hole row if a cell in that row

has
the
value 0 (zero).
Dont know how to do that.
Can anyone help me with a tip how to accomplish this.
:)








  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Makro in excel

That should be

For i = 1 To Cells(Rows.Count, "E").End(xlUp).Row
Rows(i).Hidden = Cells(i, "E").Value = 0 And _
Not IsEmpty(Cells(i, "E").Value)
Next i


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
I want the macro to go thru the hole worksheet row by row.
If the cell e3,e4 and so on are zero the row should be hidden.

"Bob Phillips" skrev:

Any cell?

Rows(5).Hidden = Application.Countif(Rows(5),0) 0

or a specific cell?

Rows(5).Hidden = Range("M5") .value = 0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
Hi!
I want to make a macro that hides the hole row if a cell in that row

has
the
value 0 (zero).
Dont know how to do that.
Can anyone help me with a tip how to accomplish this.
:)






  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ted
 
Posts: n/a
Default Makro in excel

Many thanks Bob!
Your answer really helped me out.

Regards Ted

"Bob Phillips" skrev:

That should be

For i = 1 To Cells(Rows.Count, "E").End(xlUp).Row
Rows(i).Hidden = Cells(i, "E").Value = 0 And _
Not IsEmpty(Cells(i, "E").Value)
Next i


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
I want the macro to go thru the hole worksheet row by row.
If the cell e3,e4 and so on are zero the row should be hidden.

"Bob Phillips" skrev:

Any cell?

Rows(5).Hidden = Application.Countif(Rows(5),0) 0

or a specific cell?

Rows(5).Hidden = Range("M5") .value = 0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ted" wrote in message
...
Hi!
I want to make a macro that hides the hole row if a cell in that row

has
the
value 0 (zero).
Dont know how to do that.
Can anyone help me with a tip how to accomplish this.
:)






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
Stop excel from dropping the 0 in the beginning of a number? Rosewood Setting up and Configuration of Excel 12 April 4th 23 02:12 PM
Open Excel 2003 from Windows Explorer pmpjr Excel Discussion (Misc queries) 9 September 11th 06 03:58 PM
Need suggestions for some uses of Ms Excel Bible John Excel Discussion (Misc queries) 1 February 27th 06 05:30 PM
Excel Range Value issue (Excel 97 Vs Excel 2003) Keeno Excel Discussion (Misc queries) 2 June 13th 05 02:01 PM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 08:07 PM


All times are GMT +1. The time now is 01:32 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"