Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to hide rows, but not blank rows used for formatting | Excel Programming | |||
Macro hide rows with blank data in cells | Excel Programming | |||
Hide rows of cells that are blank | Excel Discussion (Misc queries) | |||
hide blank rows | Excel Programming | |||
Hide columns & rows that contain "0" or blank in a range of cells | Excel Worksheet Functions |