PDA

View Full Version : Trigger a print macro by specific cell value.



sivadnitram
09-11-2008, 01:29 PM
Good evening,
I am a novice to excel and am enjoying rummaging around, but I have a problem. I have a workbook with sheet 1 and sheet 2. I have used the macro recorder to record a macro named PRTSHEET2 attached to button named PRINT. This works fine. Now my problem. On sheet 1 cell A30 is a value taken from sheet 2 and cell A31 likewise is a value from sheet 2.
On sheet 1 cell A32 is the sum of cells A30 and A31. The value in cell A32 can be any value betgween 3 and 55. What I am attempting to do is this:-when cell A32 equals 33 (and only 33) the PRTSHEET2 macro is triggered automatically (no user input e.g the computer and printer may be unattended when cell A32 changes to 33) I have tried playing around with various VBA codes I have found on this site by all to no avail. Any help would be of great help and very much appreciated. Thank you in anticipation. Martin

Simon Lloyd
09-11-2008, 01:35 PM
When you say the value can change when the sheet is unattended i.e has a timer or such to recalculate then drop this in the worksheet code module (sheet1)

Private Sub Worksheet_Calculate()
If Me.Range("A32").Value = 33 Then
Call PRINTSHEET2
End If
End Sub
when the worksheet recalculates and A32 is 33 it will call your print macro!

Simon Lloyd
09-11-2008, 05:02 PM
Martin, if this has solved your problem please mark the thread solved by going to Thread Tools at the top of this thread and choose Mark Thread Solved and then click perform action.