Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default hide rows of blank cells

this is the code i have

Sub StatesCleanup()
Dim rngCell As Range
Dim rng As Range

Set rng = Sheets("Summary").Range("c24:c74")

For Each rngCell In rng.Cells
If rngCell.Value = "" Then
rngCell.EntireRow.Hidden = True
End If
Next rngCell


End Sub


but there is a second range (d24:d74) that may ahve different cells that are
blank. If i just set the rang to c24:d74 the it hides rows that are blank in
one cloumn but have a vlue in the other. I only want to hide rows that are
blank in both columns. any help would be greatly appreciated thanks!
--
Thanks,

Galen
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default hide rows of blank cells

Try the below

Sub StatesCleanup()
Dim rngCell As Range
Dim rng As Range

Set rng = Sheets("Summary").Range("c24:c74")

For Each rngCell In rng.Rows
If Trim(rngCell.Offset(, 0) & rngCell.Offset(, 1)) = "" Then
rngCell.EntireRow.Hidden = True
End If
Next rngCell

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Galen" wrote:

this is the code i have

Sub StatesCleanup()
Dim rngCell As Range
Dim rng As Range

Set rng = Sheets("Summary").Range("c24:c74")

For Each rngCell In rng.Cells
If rngCell.Value = "" Then
rngCell.EntireRow.Hidden = True
End If
Next rngCell


End Sub


but there is a second range (d24:d74) that may ahve different cells that are
blank. If i just set the rang to c24:d74 the it hides rows that are blank in
one cloumn but have a vlue in the other. I only want to hide rows that are
blank in both columns. any help would be greatly appreciated thanks!
--
Thanks,

Galen

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default hide rows of blank cells

that worked great! thanks
--
Thanks,

Galen


"Jacob Skaria" wrote:

Try the below

Sub StatesCleanup()
Dim rngCell As Range
Dim rng As Range

Set rng = Sheets("Summary").Range("c24:c74")

For Each rngCell In rng.Rows
If Trim(rngCell.Offset(, 0) & rngCell.Offset(, 1)) = "" Then
rngCell.EntireRow.Hidden = True
End If
Next rngCell

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Galen" wrote:

this is the code i have

Sub StatesCleanup()
Dim rngCell As Range
Dim rng As Range

Set rng = Sheets("Summary").Range("c24:c74")

For Each rngCell In rng.Cells
If rngCell.Value = "" Then
rngCell.EntireRow.Hidden = True
End If
Next rngCell


End Sub


but there is a second range (d24:d74) that may ahve different cells that are
blank. If i just set the rang to c24:d74 the it hides rows that are blank in
one cloumn but have a vlue in the other. I only want to hide rows that are
blank in both columns. any help would be greatly appreciated thanks!
--
Thanks,

Galen

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default hide rows of blank cells


Galen,

Try:


Code:
--------------------


Option Explicit
Sub StatesCleanup()
Dim a As Long
For a = 24 To 74 Step 1
If Cells(a, "C") = "" And Cells(a, "D") = "" Then Rows(a).EntireRow.Hidden = True
Next a
End Sub


--------------------



Have a great day,
Stan


--
stanleydgromjr
------------------------------------------------------------------------
stanleydgromjr's Profile: http://www.thecodecage.com/forumz/member.php?userid=503
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=126786

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 to hide rows, but not blank rows used for formatting hko78 Excel Programming 10 May 14th 08 07:58 PM
Macro hide rows with blank data in cells [email protected] Excel Programming 6 August 22nd 07 09:10 PM
Hide rows of cells that are blank dford Excel Discussion (Misc queries) 9 February 4th 07 11:35 PM
hide blank rows violet Excel Programming 3 November 9th 06 09:20 AM
Hide columns & rows that contain "0" or blank in a range of cells lw new guest Excel Worksheet Functions 0 August 18th 05 04:27 PM


All times are GMT +1. The time now is 07:12 AM.

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"