Run macro as soon as specific text is added to a cell with numeric value already within

brumby

Active Member
Joined
Apr 1, 2003
Messages
400
Hi all,

Ive managed to get work worksheet to only calculate a cell if text is added. This allows me to plot a suppliers delivery and only consider it once I add "- arrived " EG below

A1 = 1000
B1 ( =A1 ) = 0

When delivery arrives

A1 = "1000 arrived"
B1 NOW RETURNS = 1000

As soon as I add "*ar*" into A1 ( ar should cover any typos etc ), I would like to run "Macro1"

Is this possible?

Many Thanks!!!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You can use an event.
Events are placed on the sheet they belong.
Not in a module!

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, ActiveSheet.Columns("A")) Is Nothing Then Exit Sub
If Target Like "*ar*" Then Macro1
End Sub
 
Upvote 0
Supoerb, many thanks, I want to build it into the below is this possible? So only run Macro cpy if the range n6:w500 contains the "ar" text?

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Intersect(Target, Range("n6:w500")) Is Nothing Then Call cpy
If Not Intersect(Target, Range("i6:k500")) Is Nothing Then Call cpy1
If Not Intersect(Target, Range("AB6:AB500")) Is Nothing Then Call cpy2
Application.EnableEvents = True
End Sub
 
Upvote 0
If Not Intersect(Target, Range("n6:w500")) Is Nothing And Target Like "*ar*" Then Call cpy
 
Upvote 0
superb thank you, 1 very very very last bit of help as I am now getting a problem if I undo or delete something.

So if I delete or undo anything in Range("n6:w500") I would like to call cpy2
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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