![]() |
Run a macro when a cell is changed by an outside source
I am trying to run a macro when cell E5 is equal to 1. I have the
following code in my workbook: Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target.Address Case "$E$5" If Target.Value = 1 Then Call Archive End If Case Else End Select End Sub So this should run the "Archive" macro when E5 is 1. It does run the macro perfectly when I manually input the value 1 into that cell. No problems whatsoever. But, that cell is grabbing its value from some external software called ProServer, the cell formula is =PROSERVR|'GP1'!RESULT_1. The value is sent as a bit, so Excel sees it as 0 or 1. If I watch the sheet while my ProServer program is running, it clearly changes the value from 0 to 1 and then back to 0, as it should. But my macro does not run when this occurs. My question is, how is my entering the value manually any different than grabbing a value from an outside soure. Auto-calculate is on, I'm running Excel 2003 on WinXP if that helps. Let me know if more details are needed. Thanks for any help you can give. -Jon |
Run a macro when a cell is changed by an outside source
Does anything else in the worksheet respond to E5 changing? For example, if
E6 contains =E5+1, will it change to reflect the change in E5? -- Gary''s Student "Jon" wrote: I am trying to run a macro when cell E5 is equal to 1. I have the following code in my workbook: Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target.Address Case "$E$5" If Target.Value = 1 Then Call Archive End If Case Else End Select End Sub So this should run the "Archive" macro when E5 is 1. It does run the macro perfectly when I manually input the value 1 into that cell. No problems whatsoever. But, that cell is grabbing its value from some external software called ProServer, the cell formula is =PROSERVR|'GP1'!RESULT_1. The value is sent as a bit, so Excel sees it as 0 or 1. If I watch the sheet while my ProServer program is running, it clearly changes the value from 0 to 1 and then back to 0, as it should. But my macro does not run when this occurs. My question is, how is my entering the value manually any different than grabbing a value from an outside soure. Auto-calculate is on, I'm running Excel 2003 on WinXP if that helps. Let me know if more details are needed. Thanks for any help you can give. -Jon |
Run a macro when a cell is changed by an outside source
Yes, I have a formula in another cell that says =IF(E5=1,"printing","")
and it works just as you would expect. I tried to run my macro from this, where the macro ran when the cell said "printing". Still no luck! |
Run a macro when a cell is changed by an outside source
Fixe, I had to use Workcheet_Calculate instead of Worksheet_Change
Jon wrote: Yes, I have a formula in another cell that says =IF(E5=1,"printing","") and it works just as you would expect. I tried to run my macro from this, where the macro ran when the cell said "printing". Still no luck! |
All times are GMT +1. The time now is 11:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com