After using a copy and paste link command, can it run a macr

sam99car

New Member
Joined
May 20, 2002
Messages
19
Hello,

My question is: After using the copy command on one spreadsheet, and using the paste link feature to paste to another worksheet in the same workbook, can it automatically run a macro?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hello,

OK-I've found some info using this site regarding "Worksheet_Change" and this is my code:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim rng As Range

'Set rng = Range("f4:f154")
If Target = [F4] Then
Exit Sub
Else
MsgBox "Hello"
End If

End Sub

How do I make it check a range?
 
Upvote 0
Such as:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim Targets As Range
Set Targets = Range("G20")
If Targets.Address = "$G$20" Then
If Range("G20").Value < 0 Then
Exit Sub
Else
MsgBox "You must enter a negative" & Chr(10) & " value for this
tranfer !"
Range("G20").Activate
End If
End If
End Sub


If it's a column... Target.Column = 1 (for A)
 
Upvote 0
Hello Jim,

Sorry I've been trying to get this thing to work but I just can't do it.

Basically, I have formulas in c4,d4,e4 which affect f4. If there are any changes to f4 to f154, call a macro.

The code below kind of works but if I make changes in g4 or anywhere on the wrksht, the macro is called.

Please ignore the remarks stmts as I was experimenting.

AARRGH!! Any other suggestions.

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

'Set rng = Range("f4:f154")

'If Union(Target, rng).Address = rng.Address Then
'If Union(Target, [F4:F154]).Address = [F4:F154].Address Then
'If Intersect(Target, Range("F4:F154")) Is Nothing Then

If Target = [f4] Then
Exit Sub
Else
Call Update_x_and_Media
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,203,553
Messages
6,056,063
Members
444,841
Latest member
SF_Marnie

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