G
Guest
I have a workbook which currently has 3 sheets. Currently All the
information in entered on a sheet titled <Data Entry>. The information is
then displayed in a Sheet 2. Some or the rows in Sheet 2, don't always have
information in them so I got a macro that will hide those rows, I created a
column <AJ> which either has a constant value in it if I never want it hidden
or it pulls the value from some where in sheet 2 to determine if it is blank
or not. Currently the macro only runs when you click on a cell in sheet 2 or
when you change cells in sheet 2. I would like it to run when ever you print
sheet 2, and when you print preview sheet 2, or if possible to run when ever
information in the <Data Entry> sheet is changed if possible. My code is
entered in the sheet 2 section of VB and looks like this:
<
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In Range("AJ1:AJ98")
If cell.Value = "" Then _
cell.EntireRow.Hidden = True
Next cell
End With
End Sub
Thanks in advance for your help and advice.
information in entered on a sheet titled <Data Entry>. The information is
then displayed in a Sheet 2. Some or the rows in Sheet 2, don't always have
information in them so I got a macro that will hide those rows, I created a
column <AJ> which either has a constant value in it if I never want it hidden
or it pulls the value from some where in sheet 2 to determine if it is blank
or not. Currently the macro only runs when you click on a cell in sheet 2 or
when you change cells in sheet 2. I would like it to run when ever you print
sheet 2, and when you print preview sheet 2, or if possible to run when ever
information in the <Data Entry> sheet is changed if possible. My code is
entered in the sheet 2 section of VB and looks like this:
<
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In Range("AJ1:AJ98")
If cell.Value = "" Then _
cell.EntireRow.Hidden = True
Next cell
End With
End Sub
Thanks in advance for your help and advice.