Hi Stu.
I really don't like the way the first one is written.
Its bugging me so I had to do this.
Sub MyPPp()
Dim x As Long, y As Long, Str As String
Application.Cells.Rows.Hidden = False
Str = MsgBox("to Hide blanks pick YES, to Hide content pick NO", vbYesNoCancel)
If Str = vbCancel Then End
For x = 4 To 285 Step 24
For y = x To x + 17
If Str = vbYes Then
If Cells(y, 2) = "" Then Cells(y, 3) = "=1/0"
Else
If Cells(y, 2) < "" Then Cells(y, 3) = "=1/0"
End If
Next y
Next x
Range("C4:C285").SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow.Hidden = True
Columns(3).ClearContents
End Sub
If you already have data in your C column, can you just insert a new column and hide it?
This one I hope is a little more clear to understand.
I know it supposed to start in B3, but the above wouldn't work without a lot more code just to deal with one cell. You could just
as easily do whatever manually to B3.
As for the second macro, I'm not going there.
Regards Robert
"Stu" wrote in message ...
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
2nd Macro:
Sub MainHide()
Application.ScreenUpdating = False
Main.UnProtect Password:="Jan"
Dim hideRows As Range
With Range("G3:G2401")
.EntireRow.Hidden = False
.AutoFilter Field:=1, Criteria1:="="
On Error Resume Next
Set hideRows = .Offset(1, 0).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
Selection.AutoFilter
If Not hideRows Is Nothing Then hideRows.EntireRow.Hidden = True
Range("G202,G402,G602,G802,G1002,G1202,G1402," & _
"G1602,G1802,G2002,G2202,G2402").EntireRow.Hid den = False
Main.Protect Password:="Jan"
Application.ScreenUpdating = True
End Sub
--
Many Thanks,
Stu
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.590 / Virus Database: 373 - Release Date: 16/02/2004