LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Need help getting macro to run

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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"