Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Run macro whenever cell changes

Hi
Need help with macro
The question is... how to run macro each time when cell changes but as
result of formula calculation (mean without selection this cell)
Example :
I wish to run macro when value in cell A1 is changed by changing value in
B1 (formula in A1 =B1)

Thanks

eLaCiD


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run macro whenever cell changes


I am not sure If I get your question.

B1 is = the value of A1?

Why would you need a macro change that? Just make sure you have
automatic calculation on.


--
Bearacade
------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=547906

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Run macro whenever cell changes

Paste this code in the appropriate sheet...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

On Error Resume Next
Set rng = Intersect(Target, Range("A1").Precedents)
On Error GoTo 0

If Not rng Is Nothing Then
MsgBox "Tada"
End If
End Sub

--
HTH...

Jim Thomlinson


"eLaCiD" wrote:

Hi
Need help with macro
The question is... how to run macro each time when cell changes but as
result of formula calculation (mean without selection this cell)
Example :
I wish to run macro when value in cell A1 is changed by changing value in
B1 (formula in A1 =B1)

Thanks

eLaCiD



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Run macro whenever cell changes

Hi eLaCiD,

Try something like:

'=============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range

Set rng = Range("A1")

If Not Intersect(rng.Precedents, Target) Is Nothing Then
Call myMacro
End If

End Sub
'<<=============

---
Regards,
Norman



"eLaCiD" wrote in message
...
Hi
Need help with macro
The question is... how to run macro each time when cell changes but as
result of formula calculation (mean without selection this cell)
Example :
I wish to run macro when value in cell A1 is changed by changing value in
B1 (formula in A1 =B1)

Thanks

eLaCiD




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Run macro whenever cell changes

Hi eLaCiD,

To allow for the posiibility that the range of interest does not have
precedent cells, an error handler should be included - as in Jim's superior
suggestion.

---
Regards,
Norman




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Run macro whenever cell changes

Realy fast :))
Thanks ...


eLaCiD


Reply
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
'IF' Macro to insert cell contents to alternate cell if cell not e Gryndar Excel Worksheet Functions 6 December 20th 08 05:02 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
macro to run a separate macro dependent on value in cell scottwilsonx[_13_] Excel Programming 3 July 26th 04 02:30 PM
Please help! Macro to change cell contents based on cell to the left Jennifer[_8_] Excel Programming 7 March 4th 04 01:06 AM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 01:06 PM.

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

About Us

"It's about Microsoft Excel"