View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Adding to a Row Range

Dim rng as Range
Do Until ActiveCell < ""
if rng is nothing then
set rng = ActiveCell
else
set rng = union(rng,activecell)
end if
if ActiveCell.row = 1 then exit do
ActiveCell.Offset(-1, 0).Select
Loop
if not rng is nothing then
rng.Entirerow.Hidden = True
end if

--
Regards,
Tom Ogilvy



"VicWestVan" wrote:

I currently have a simple Loop applied for example to rows 1- 10 that Hides
consecutive empty rows... it checks a row (starting from 10), if the row is
empty, the row is hidden, then moves to row 9 and repeats, all the way to row
1.

Do Until ActiveCell < ""
Selection.EntireRow.Hidden = True
ActiveCell.Offset(-1, 0).Select
Loop

Any suggestions on how to change the code to check a row i.e. Row 10, if the
row is empty, then add Row 10 to the Row Range, then check Row 9, add 9:10 to
the Row Range, then after all checking, apply the HiddenRows command to the
final Row Range?

Thx,
Vic