PDA

View Full Version : Cell update from a Link that needs to be ENTERED



laidback5699
2011-11-04, 04:42 PM
Good Day,
First posting, have read and used by modification some of Ken's work. THANKS!!!!.I have learned quite a bit.
I am having a very difficult time trying to use the update to Cell A1 (which is under the Private Sub Worksheet), this update comes from a machine. This Cell is supposed to run Module2.
The Cell does update to a One(1) when the machine tells the Cell to update but no PrintToPDF_Late.
If I manually enter a One(1) in cell A1 and push the Enter key the macro runs just fine.
Since I am working with Machine logic all is a 1 or 0.
I am using Excel 2003

What have I missed ?
All works (Thanks Ken ) except the update Cell A1.
Thanks for all your help.
Kevin

Ken Puls
2011-11-04, 05:54 PM
Hi there, and welcome to the forum.

Try replacing your Worksheet_Change event with the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Parent.Range("A1").Value = 1 Then
Call PrintToPDF_Late
End If
End Sub

Let me know if that does the trick.

laidback5699
2011-11-04, 06:11 PM
Hi Ken, Thanks for letting me be part of the Forum, and the FAST response.
I plugged in your code, and the sheet still sits there. A One (1) does populate the cell as it has done.
This is where it stops, I put a MsgBox in and it never gets there.
When I remove the link in the cell, enter a One (1), and use the Enter Key all works Great.

Kevin

Ken Puls
2011-11-04, 06:29 PM
I need to know a bit more about how you're driving the update. Is it just refreshing data from somewhere, or does the change only happen when you physically enter data in (any) cell?

The Worksheet_Change routine only fires when you put new data into a cell. (For our purposes it would be close enough to say that pressing the Enter key on a cell is what triggers it.)

If you're driving updates from somewhere else, you'll probably want to looka t the Worksheet_Calculate event... but that fires much more often...

laidback5699
2011-11-04, 06:52 PM
The whole worksheet is updated via RSLinx, Rockwell Automation software.
The worksheet is a LIVE always-updating the sheet.
The Machine has an operator interface that has a SPC Count Reset pushbutton.
This pushbutton tag is the N15:15 reference in cell A1.
The operator will push and hold the reset pushbutton for Five (5) seconds, this time is to allow the worksheet to run the appropriate Macro to save the Production data for that shift. All the machine will send to the A1 cell is a One (1) for run the Macro or a Zero (0).
As you can see, It will E-Mail the PDF’s to people of choosing.

The idea would be to trigger the Macro ‘PrintToPDF_Late’ when A1 = One (1)
The Machine has no way of sending an ENTER KEY function.

Thanks for your Time :>)

Ken Puls
2011-11-04, 07:10 PM
Okay, try this and let me know if it works. I'm just a little leary that it may fire too often:


Private Sub Worksheet_Calculate()
If Worksheets("MO1062").Range("A1").Value = 1 Then
Call PrintToPDF_Late
End If
End Sub