ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to call a macro from a worksheet event? (https://www.excelbanter.com/excel-programming/285445-how-call-macro-worksheet-event.html)

lopsided[_3_]

how to call a macro from a worksheet event?
 
Dear all,

I need to call a macro when data is pasted into a particular cell on
particular worksheet. I am having a few problems with this, any hel
would be greatly appretiated.

Many thanks,

To

--
Message posted from http://www.ExcelForum.com


Don Guillett[_4_]

how to call a macro from a worksheet event?
 
Use a worksheet change event by right click on sheet tabview codeinsert
thismodifysave
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < "$F$1" Then Exit Sub
Call mysub
End Sub
Sub mysub()
MsgBox "Hi"
End Sub

--
Don Guillett
SalesAid Software

"lopsided" wrote in message
...
Dear all,

I need to call a macro when data is pasted into a particular cell on a
particular worksheet. I am having a few problems with this, any help
would be greatly appretiated.

Many thanks,

Tom


---
Message posted from
http://www.ExcelForum.com/




lopsided[_4_]

how to call a macro from a worksheet event?
 
Hi Don,

That worked fine - i didnt realise this code needed to go in the
worksheet code, i kept trying to put coding in a separate module!

Many thanks,

Tom


---
Message posted from http://www.ExcelForum.com/


Don Guillett[_4_]

how to call a macro from a worksheet event?
 
glad to help. UDF functions need to go in a general module. In the
ThisWorkbook module there is code that will act of EACH sheet in the
workbook. Take a look.

--
Don Guillett
SalesAid Software

"lopsided" wrote in message
...
Hi Don,

That worked fine - i didnt realise this code needed to go in the
worksheet code, i kept trying to put coding in a separate module!

Many thanks,

Tom


---
Message posted from
http://www.ExcelForum.com/




BrianB

how to call a macro from a worksheet event?
 
You need to use the worksheet change event (doubleclick the sheet name
in VB Editor) :-

'------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then MsgBox ("change")
End Sub
'-------------------------------------------------




lopsided wrote in message ...
Dear all,

I need to call a macro when data is pasted into a particular cell on a
particular worksheet. I am having a few problems with this, any help
would be greatly appretiated.

Many thanks,

Tom


---
Message posted from http://www.ExcelForum.com/


lopsided[_5_]

how to call a macro from a worksheet event?
 
aah it all makes sense now!
cheers,
Tom


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com