Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I would be grateful if someone could provide me with code that will hide a
line when a particular cell (e.g. B) is empty. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub hiderowifcolempty()
For i = Cells(Rows.Count, "b").End(xlUp).Row To 1 Step -1 If Len(Application.Trim(Cells(i, "b"))) < 1 Then _ Rows(i).Hidden = True Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Christine" wrote in message ... I would be grateful if someone could provide me with code that will hide a line when a particular cell (e.g. B) is empty. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
That works nicely. Could you tell me how to specify to hide only rows 5 to
10 when cell b is empty? "Don Guillett" wrote: Sub hiderowifcolempty() For i = Cells(Rows.Count, "b").End(xlUp).Row To 1 Step -1 If Len(Application.Trim(Cells(i, "b"))) < 1 Then _ Rows(i).Hidden = True Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Christine" wrote in message ... I would be grateful if someone could provide me with code that will hide a line when a particular cell (e.g. B) is empty. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You just need to change one line (the For statement):
Sub hiderowifcolempty() For i = 10 To 5 Step -1 If Len(Application.Trim(Cells(i, "B"))) < 1 Then _ Rows(i).Hidden = True Next i End Sub Hope this helps, Hutch "Christine" wrote: That works nicely. Could you tell me how to specify to hide only rows 5 to 10 when cell b is empty? "Don Guillett" wrote: Sub hiderowifcolempty() For i = Cells(Rows.Count, "b").End(xlUp).Row To 1 Step -1 If Len(Application.Trim(Cells(i, "b"))) < 1 Then _ Rows(i).Hidden = True Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Christine" wrote in message ... I would be grateful if someone could provide me with code that will hide a line when a particular cell (e.g. B) is empty. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you both, Don and Tom.
"Tom Hutchins" wrote: You just need to change one line (the For statement): Sub hiderowifcolempty() For i = 10 To 5 Step -1 If Len(Application.Trim(Cells(i, "B"))) < 1 Then _ Rows(i).Hidden = True Next i End Sub Hope this helps, Hutch "Christine" wrote: That works nicely. Could you tell me how to specify to hide only rows 5 to 10 when cell b is empty? "Don Guillett" wrote: Sub hiderowifcolempty() For i = Cells(Rows.Count, "b").End(xlUp).Row To 1 Step -1 If Len(Application.Trim(Cells(i, "b"))) < 1 Then _ Rows(i).Hidden = True Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Christine" wrote in message ... I would be grateful if someone could provide me with code that will hide a line when a particular cell (e.g. B) is empty. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I automatically hide empty columns in Excel? | Excel Discussion (Misc queries) | |||
Is there a way to automatically hide empty rows? | Excel Worksheet Functions | |||
Hide Empty Rows When Printing | Excel Worksheet Functions | |||
Hide empty field error | Excel Worksheet Functions | |||
Format to hide empty rows | Excel Discussion (Misc queries) |