ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Makro in excel (https://www.excelbanter.com/excel-worksheet-functions/96535-makro-excel.html)

Ted

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.
:)

Bob Phillips

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.
:)




Ted

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.
:)





Stefi

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.
:)


Bob Phillips

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.
:)







Bob Phillips

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.
:)







Ted

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.
:)








All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com