LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Explain Macro?

The macro cycles through the 12 ranges of 17 (or 18, for the first)
cells.

If a cell is blank, it assigns the cell below it to the hiderange Range.
Union() gives a run-time error if one of the ranges is Nothing, so
hiderange is first checked - if it's Nothing, then the cell below is
assigned, if it's not Nothing (i.e., cell(s) have been assigned to it),
then the cell below is added using Union().

If the cell is not blank, then the cell below it is assigned to the
unhiderange.

After all cells are assigned to either one range or the other, the hide
range (if it's had any cells assigned) is hidden and the unhiderange (if
it's had any cells assigned) is unhidden.


In article ,
"Stu" wrote:

Could someone please explain these two macros in plain English for me:

1st macro:

Public Sub All()

Dim hideRange As Range
Dim unhideRange As Range
Dim Rng As Range
For Each Rng In Range("B3:B21,B28:B45,B52:B69," & _
"B76:B93,B100:B117,B124:B141,B148:B165," & _
"B172:B189,B196:B213,B220:B237,B244:B261,B268:B285 ")
If Rng.Value = "" Then
If hideRange Is Nothing Then
Set hideRange = Rng.Offset(1, 0)
Else
Set hideRange = Union(hideRange, Rng.Offset(1, 0))
End If
Else
If unhideRange Is Nothing Then
Set unhideRange = Rng.Offset(1, 0)
Else
Set unhideRange = Union(unhideRange, Rng.Offset(1, 0))
End If
End If

Next Rng
If Not hideRange Is Nothing Then _
hideRange.EntireRow.Hidden = True
If Not unhideRange Is Nothing Then _
unhideRange.EntireRow.Hidden = False
End Sub

 
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
Please explain Maxwell Excel Worksheet Functions 1 March 31st 06 01:12 PM
Let me see if I can explain this... jsc3489 Excel Worksheet Functions 0 July 22nd 05 05:04 PM
Explain these please Sal Excel Worksheet Functions 1 March 24th 05 08:43 PM
please explain Jim Madsen Excel Programming 2 December 24th 03 04:44 PM
can someone explain what the below macro does aneurin Excel Programming 1 September 29th 03 07:52 PM


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