Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Please explain | Excel Worksheet Functions | |||
Let me see if I can explain this... | Excel Worksheet Functions | |||
Explain these please | Excel Worksheet Functions | |||
please explain | Excel Programming | |||
can someone explain what the below macro does | Excel Programming |