billythedj66
Board Regular
- Joined
- Jan 6, 2003
- Messages
- 126
Hello,
I have a worksheet named "IGE". This worksheet is used as a printout sheet that gets it's data from various other sheets within the workbook. The range of cells are A1:H343. What I am trying to do is have a macro that if the cell in column "A" of a particular row is blank, then the whole row is hidden, if not then the row is visible and has autofit applied to it. I have the following macro, but it takes about two minutes to complete:
Sub IGE()
' IGE Macro
' Edited 1/22/2003 by Bill
Sheets("IGE").Visible = True
Sheets("IGE").Select
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim c As Range
For Each c In Range("A1:A" & Range("A344").End(xlUp).Row)
If c.Value = "" Then
c.EntireRow.Hidden = True
Else: c.EntireRow.AutoFit
End If
Next c
Sheets("IGE").PrintOut
ActiveSheet.UsedRange.EntireRow.Hidden = False
Application.ScreenUpdating = True
Application.EnableEvents = True
Sheets("IGE").Visible = False
Sheets("Opening").Select
Range("B17").Select
End Sub
Any ideas on why it is so slow, or is there a better way to do the same function?
Thanks in Advance!!
I have a worksheet named "IGE". This worksheet is used as a printout sheet that gets it's data from various other sheets within the workbook. The range of cells are A1:H343. What I am trying to do is have a macro that if the cell in column "A" of a particular row is blank, then the whole row is hidden, if not then the row is visible and has autofit applied to it. I have the following macro, but it takes about two minutes to complete:
Sub IGE()
' IGE Macro
' Edited 1/22/2003 by Bill
Sheets("IGE").Visible = True
Sheets("IGE").Select
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim c As Range
For Each c In Range("A1:A" & Range("A344").End(xlUp).Row)
If c.Value = "" Then
c.EntireRow.Hidden = True
Else: c.EntireRow.AutoFit
End If
Next c
Sheets("IGE").PrintOut
ActiveSheet.UsedRange.EntireRow.Hidden = False
Application.ScreenUpdating = True
Application.EnableEvents = True
Sheets("IGE").Visible = False
Sheets("Opening").Select
Range("B17").Select
End Sub
Any ideas on why it is so slow, or is there a better way to do the same function?
Thanks in Advance!!