Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 147
Default Hide the line when cell B is empty

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Hide the line when cell B is empty

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 147
Default Hide the line when cell B is empty

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default Hide the line when cell B is empty

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 147
Default Hide the line when cell B is empty

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
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
How do I automatically hide empty columns in Excel? Ned Mains Excel Discussion (Misc queries) 3 April 29th 23 07:44 PM
Is there a way to automatically hide empty rows? Christine Excel Worksheet Functions 1 April 12th 07 10:22 PM
Hide Empty Rows When Printing Bob Excel Worksheet Functions 5 August 20th 05 12:57 PM
Hide empty field error J Excel Worksheet Functions 3 June 28th 05 05:10 AM
Format to hide empty rows tamato43 Excel Discussion (Misc queries) 4 May 10th 05 10:16 PM


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