LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default macro to hide empty rows

Did you notice a different color??? Below is ONE line. So either use the
delete key to bring up the second part or put in a line continuation
character which is a space and underscore. xlByRows _


lr = Cells.Find("*", Cells(Rows.Count, Columns.Count), , , xlByRows,
xlPrevious).Row


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"marjattanb" wrote in message
...
Hi,

thanks again (do u ever sleep??)

Now it gets stuck with SYNTAX ERROR with this:
lr = Cells.Find("*", Cells(Rows.Count, Columns.Count), , , xlByRows,
xlPrevious).Row

And I am stuck again..

"Don Guillett" wrote:

Try this

Sub hideemptyrows()
lr = Cells.Find("*", Cells(Rows.Count, Columns.Count), , , xlByRows,
xlPrevious).Row
For i = 1 To lr
lc = Cells(i, Columns.Count).End(xlToLeft).Column
For j = 1 To lc
If Application.CountA(Rows(i)) < 1 Or _
Cells(i, j).HasFormula And Cells(i, j) = "" Then
Rows(i).Hidden = True
End If
Next j
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rick Rothstein" wrote in message
...
I don't get that macro to work if there are cells containing formulas
that
evaluate to the empty string.

--
Rick (MVP - Excel)


"Don Guillett" wrote in message
...

You may desire to use a macro that looks at the number of hits

Sub hideemptyrows()
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Application.CountA(Rows(i)) < 1 Then Rows(i).Hidden = True
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"marjattanb" wrote in message
...
Hello,

I am trying to hide empty rows in a named range (A5:BU1111) where all
"empty" rows however do have a formula in several columns (where the
value is
"").

The only way I have managed is to create a dummy column (which I have
named
"ROW_SHRINK_AREA", which creates some values which indicate that the
row
in
question is not empty. Then I use the macro:

Sub MakeEmptyRowsGoAway()
Application.Goto Reference:="ROW_SHRINK_COLUMN"
For Each R In Application.Intersect(ActiveSheet.UsedRange, _
ActiveSheet.Range("ROW_SHRINK_COLUMN")).Cells
varValue = R.Value
If IsNumeric(varValue) Then
If varValue = 0 Then
R.EntireRow.Hidden = True
End If
End If
Next R
End Sub

Would someone please advise me a faster method?







 
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
Help on Macro to hide empty rows nLeBlanc21 Excel Discussion (Misc queries) 4 January 19th 10 10:04 PM
Is there a way to automatically hide empty rows? Christine Excel Worksheet Functions 1 April 12th 07 10:22 PM
Macro to hide rows with a certain cell empty then set print area and print tahrah Excel Programming 12 January 9th 07 03:47 AM
URGENT!! Use macro button to hide empty columns and rows...HELP!!!! Hawk Excel Programming 8 July 8th 05 10:38 PM
Macro to hide rows with empty cells tp58tp Excel Worksheet Functions 2 November 13th 04 02:01 PM


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