Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Having problems clearing a row.

Dear folks
I found some code from this site, regarding clearing out empty spaces and hiding the row. However, if the row contains formulas, the row is not hidden. Is there a better code some one might know that tackles this issue or make a modification to this code, the code I used is below

Sub mergeall(

Dim r As Lon
Application.ScreenUpdating = Fals
With Worksheets("Sheet2"
For r = .UsedRange.Rows(.UsedRange.Rows.Count).Row To 128 Step -
If Application.CountA(Range(Cells(r, "D"), Cells(r, "F"))) = 0 The
.Rows(r).Hidden = Tru
End I
Nex
End Wit


Application.ScreenUpdating = Tru
End Su

Any pointers will be appreciated

Cheers

Ranjan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Having problems clearing a row.

Ranjan,

If you have formulas that return "" values, then you could modify your code
by changing

If Application.CountA(Range(Cells(r, "D"), Cells(r, "F"))) = 0 Then

to

If (Cells(r, "D").Value = "") And (Cells(r,"E").Value = "") And (Cells(r,
"F").Value) = "" Then

HTH,
Bernie
MS Excel MVP


"Ranjan as usual" wrote in message
...
Dear folks,
I found some code from this site, regarding clearing out empty spaces and

hiding the row. However, if the row contains formulas, the row is not
hidden. Is there a better code some one might know that tackles this issue
or make a modification to this code, the code I used is below.

Sub mergeall()


Dim r As Long
Application.ScreenUpdating = False
With Worksheets("Sheet2")
For r = .UsedRange.Rows(.UsedRange.Rows.Count).Row To 128 Step -1
If Application.CountA(Range(Cells(r, "D"), Cells(r, "F"))) = 0

Then
.Rows(r).Hidden = True
End If
Next
End With


Application.ScreenUpdating = True
End Sub

Any pointers will be appreciated.

Cheers,

Ranjan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Having problems clearing a row.

Hey Bernie
It worked great. Thanx for the help
Cheers

Ranjan
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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Clearing out spaces Simon Excel Worksheet Functions 1 November 2nd 07 03:25 PM
Clearing #N/A's in one go? Lee Harris Excel Worksheet Functions 5 November 22nd 05 06:52 PM
Clearing #VALUE skateblade Excel Worksheet Functions 3 October 15th 05 10:34 PM
Problems clearing a cell Ralph Private Excel Programming 3 August 1st 03 01:29 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"