ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   CONDITIONAL HIDE/UNHIDE ROWS (https://www.excelbanter.com/excel-discussion-misc-queries/142640-conditional-hide-unhide-rows.html)

[email protected]

CONDITIONAL HIDE/UNHIDE ROWS
 
I have code to hide rows (which works) and I also have code to unhide
rows. I'm simply having trouble combining the code into one macro.
If anybody can help I will greatly appreciate it. Below is a copy of
the code. Thanks.

Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value = 0 Then
Rows(RowNdx).Hidden = True

End If
Next RowNdx
End Sub

________________________________
Sub Unhide()

Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value 0 Then
Rows(RowNdx).Hidden = False
End If
Next RowNdx

End Sub


papou

CONDITIONAL HIDE/UNHIDE ROWS
 
Hi

Sub hide_unhide_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
Select Case Cells(RowNdx, "A").Value
Case Is = 0
Rows(RowNdx).Hidden = True
Case Is 0
Rows(RowNdx).Hidden = False
End Select
Next RowNdx
End Sub

HTH
Cordially
Pascal


a écrit dans le message de news:
...
I have code to hide rows (which works) and I also have code to unhide
rows. I'm simply having trouble combining the code into one macro.
If anybody can help I will greatly appreciate it. Below is a copy of
the code. Thanks.

Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value = 0 Then
Rows(RowNdx).Hidden = True

End If
Next RowNdx
End Sub

________________________________
Sub Unhide()

Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value 0 Then
Rows(RowNdx).Hidden = False
End If
Next RowNdx

End Sub




[email protected]

CONDITIONAL HIDE/UNHIDE ROWS
 
On May 14, 9:30 am, "papou" wrote:
Hi

Sub hide_unhide_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
Select Case Cells(RowNdx, "A").Value
Case Is = 0
Rows(RowNdx).Hidden = True
Case Is 0
Rows(RowNdx).Hidden = False
End Select
Next RowNdx
End Sub

HTH
Cordially
Pascal

a écrit dans le message de news:
. com...



I have code to hide rows (which works) and I also have code to unhide
rows. I'm simply having trouble combining the code into one macro.
If anybody can help I will greatly appreciate it. Below is a copy of
the code. Thanks.


Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long


LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value = 0 Then
Rows(RowNdx).Hidden = True


End If
Next RowNdx
End Sub


________________________________
Sub Unhide()


Dim RowNdx As Long
Dim LastRow As Long


LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value 0 Then
Rows(RowNdx).Hidden = False
End If
Next RowNdx


End Sub- Hide quoted text -


- Show quoted text -


It worked perfectly! Thanks. I'm trying to teach myself this and
realize my life will be much easier once I become procificient in it.
Thanks again, oh, I simply had to change you code a bit, you had the
"A" column when I was looking for the "V" column, but you probably did
that on purpose.

James


papou

CONDITIONAL HIDE/UNHIDE ROWS
 
Hello James
Thanks for your feedback, glad it helped -;)

Cordially
Pascal
a écrit dans le message de news:
...
On May 14, 9:30 am, "papou" wrote:
Hi

Sub hide_unhide_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
Select Case Cells(RowNdx, "A").Value
Case Is = 0
Rows(RowNdx).Hidden = True
Case Is 0
Rows(RowNdx).Hidden = False
End Select
Next RowNdx
End Sub

HTH
Cordially
Pascal

a écrit dans le message de news:
. com...



I have code to hide rows (which works) and I also have code to unhide
rows. I'm simply having trouble combining the code into one macro.
If anybody can help I will greatly appreciate it. Below is a copy of
the code. Thanks.


Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long


LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value = 0 Then
Rows(RowNdx).Hidden = True


End If
Next RowNdx
End Sub


________________________________
Sub Unhide()


Dim RowNdx As Long
Dim LastRow As Long


LastRow = ActiveSheet.Cells(Rows.Count, "V").End(xlUp).Row
For RowNdx = LastRow To 5 Step -1
If Cells(RowNdx, "V").Value 0 Then
Rows(RowNdx).Hidden = False
End If
Next RowNdx


End Sub- Hide quoted text -


- Show quoted text -


It worked perfectly! Thanks. I'm trying to teach myself this and
realize my life will be much easier once I become procificient in it.
Thanks again, oh, I simply had to change you code a bit, you had the
"A" column when I was looking for the "V" column, but you probably did
that on purpose.

James




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

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