Can a macro be liked to a cell? 
Author Message
 Can a macro be liked to a cell?

Can I make a macro run everytime a cell's content is filled with a
specific number?

In other words everytime a cell say N 29 is filled with the number 1 can
I make a macro execute?

I am just a newbie so please keep that in mind when you respond.

Thank you very much,

Bruce

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Tue, 19 Oct 2004 08:27:56 GMT  
 Can a macro be liked to a cell?
If I understand what you want, you set an Event for the worksheet.

To do this,

First bring up the Visual Basic Editor ([ALT][F11])
The Project window is at the top left of your screen.  Double-click on
Sheet1, or whatever your worksheet happens to be.
Now, if you were writing the routine from scratch, you'd select Worksheet
from the left-hand dropdown of the Module window, and Change from the
right-hand dropdown.  However, you can just copy this routine:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$N$29" And Target = 1 Then
        MsgBox "Condition met"
    End If
End Sub

Hope this is clear.

Stan Scott
New York City


Quote:

> Can I make a macro run everytime a cell's content is filled with a
> specific number?

> In other words everytime a cell say N 29 is filled with the number 1 can
> I make a macro execute?

> I am just a newbie so please keep that in mind when you respond.

> Thank you very much,

> Bruce

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Tue, 19 Oct 2004 09:07:30 GMT  
 Can a macro be liked to a cell?

Hi Scott,

I did what you said and it brings up a message box "Condition met".
Where do I put the name of the macro that I want to run?

The name of the macro is "placeOrder"   I want  the macro  to run when
the number 1 is cell N 29. This is all new to me sorry if I am missing
something obvious.

I tried to replace   MsgBox "Condition met" with Run Macro placeOrder
but keep getting an error message.

Any more insight would be appreciated.

Thanks,

Bruce

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 19 Oct 2004 10:36:01 GMT  
 Can a macro be liked to a cell?
Just put in

PlaceOrder

rather than Run Macro PlaceOrder

Regards,
Tom Ogilvy


Quote:

> Hi Scott,

> I did what you said and it brings up a message box "Condition met".
> Where do I put the name of the macro that I want to run?

> The name of the macro is "placeOrder"   I want  the macro  to run when
> the number 1 is cell N 29. This is all new to me sorry if I am missing
> something obvious.

> I tried to replace   MsgBox "Condition met" with Run Macro placeOrder
> but keep getting an error message.

> Any more insight would be appreciated.

> Thanks,

> Bruce

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Tue, 19 Oct 2004 10:56:30 GMT  
 Can a macro be liked to a cell?

Thank you very much Tom.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 19 Oct 2004 11:48:23 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Running macro at active cell in stead of at cell where macro was writen

2. Merging cells - what am I doing wrong?

3. .Cells method problem - What am I doing wrong ?

4. Finding out what cell I am in

5. What cell am I in?

6. What Table Cell am I In?

7. Two Trash Cans!?!

8. I am stupid, please help me with macro

9. What row am I on - in a macro

10. change documents settings in word when i am in excel running a macro


 
Powered by phpBB® Forum Software © phpBB Group