Formatting? may be

  • Thread starter Thread starter ab3d4u
  • Start date Start date
A

ab3d4u

I do a lot of subtotaling. I have different depts with diffeent charg
codes but all share the same GL code. Ex Printing/Copy GL code 4400
for admin it will have a 001 extension while for the security dept i
will be 002. I sort expenses based on the main GL 4400. I now have t
hide a lot of rows so that my boss can see only the major expenses.
currently hide rows one by one or sector by sector. I am sure there i
a short cut for this craziness. Can you help
 
Hopefully one of these macros will give you what you need...these are just
samples...you will have to make a few small modifications...

This macro will hide all blanks in a range:
Sub HideBlanks()
Dim rng As Range
On Error Resume Next
Range("A1:A20").EntireRow.Hidden = False
Set rng = Range("A1:A20").SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.Hidden = True
End If
End Sub

This macro will hide all cells that match a certain criteria in a range
(obviously the criteria is “Hide Meâ€; get creative and change it to what you
want):
Sub HideRows()
Dim LastRow As Long
Dim i As Long
ActiveSheet.UsedRange.Rows.Hidden = False
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = LastRow To 2 Step -1
If InStr(1, Cells(i, 1), "Hide Me", vbTextCompare) + _
InStr(1, Cells(i, 2), "Hide Me", vbTextCompare) Then
Rows(i).Hidden = True
End If
Next
End Sub


Regards,
Ryan---
 
Back
Top