How can I automatically execute a macro if there a 1 or -1 in a cell

arrautxa

New Member
Joined
May 6, 2009
Messages
8
I have the following problem.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I do have a worksheet where I have several functions. One of those sub is as follows:<o:p></o:p>
<o:p></o:p>
Private Sub Worksheet_Change(ByVal Target As Excel.Range)<o:p></o:p>
If Target.Column = 1 Then
If Target.Row = 6 Then
If Target.Value = 1 Then
'Call macro here
End If
End If
End If<o:p></o:p>

<o:p></o:p>
if I place manually 1 in cell A,6 and manually click enter, it will call the macro with no problem.<o:p></o:p>
What I need help with is that I am planning to place a 1 or -1 on that cell automatically which is sent by another macro but I need help is to check if the is a 1 with the private sub above and need to perform the click automatically without my intervention. Once the macro is confirmed to be executed I would like to blank that cell in order to wait for the next instruction.
A,6 will not be the only cell that will have to check for a 1 but the check will always be on column A.
Can anybody help me with this macro.
Best Regards
Bill
 
Re: how can I trigger a macro when a range of cells in workbook XX are link to range of cells in another workbook YY

You need to disable events to prevent the loop.
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,224,602
Messages
6,179,841
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top