LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default How to call a procedure when a cell value changes?

I'm not to sharp with Intersect. But it asks the question: Is my range
(Target
included in the following range (the cells referenced by B49)
[check VBE Help to get more info]

But the idea is to use the Worksheet_Change event.
This fires every time any cell on the worksheet is manually edited.
Target is a range name attached to the changed cell.
If Target is equal to any one of the cells that B49 depends on than
do your thing.

--
steveB

Remove "AYN" from email to respond
"Bojana" wrote in message
...
It still does not work, probably because I am doing something wrong. I
must
say I know very little of VB. I am not familiar with intersect, union etc.
Is
there a place where I could read about it?

I have named all the cells that preceed my target cell (B49). If I read
this
code well, if the value of one of the listed cells changes, procedure
Run_solve will be run.

What I am missing in the code below is any reference to my target cell
(B49)

Here is what I have now:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Union(Range("C46"), Range("O46"),
Range("U46"),
Range("AA46"), Range("AG46"), Range("AM46"), Range("AS46"))) Is Nothing
Then
Run_solve
End If
End Sub

What do I need to change to make it work? Could someone please help?

Thanks

"STEVE BELL" wrote:

In the worksheet module:
Say B49 is dependent on A1, B1, C1
=========================================
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" or Target.Address = "$B$1" or
Target.Address
= "$C$1"
' procedure to run
End If
End Sub
==========================================

There is also the calculate event, but I am not sure how to trap
a given cell change
=========================================
Private Sub Worksheet_Calculate()
' maybe you can find a way to compare the before and after value of
B49
' (one way is to make this make put the value of B49 in another cell,
than

If Range("B49") < Range("AZ49") then
' run procedure

Range("AZ49").Value = Range("B49")
End If
End Sub
=========================================

to turn off Alerts - place this in any code:
========================
Application.DisplayAlerts = False
' your code
Application.DisplayAlerts = True
========================
hth
--
steveB

Remove "AYN" from email to respond
"Bojana" wrote in message
...
Hi,

I have a formula in cell B49 that calculates based on certain inputs.
How can I trigger a procedure to fire when the value of calculation in
B49
changes?

Also, how can I supress a dialog in a macro?

Thanks in advance,

Bojana








 
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
Call Procedure Ronbo Excel Programming 4 February 23rd 05 08:11 PM
Where else to look for procedure call Lulu Excel Programming 0 November 24th 04 03:07 PM
Where else to look for procedure call Lulu Excel Programming 2 November 24th 04 02:14 AM
call procedure bob Excel Programming 1 August 9th 03 12:40 AM
procedure won't call John Gittins Excel Programming 0 August 5th 03 08:17 PM


All times are GMT +1. The time now is 02:39 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"