Attach macro to a cell

M

Marco

Can you attach a macro to a cell which when clicked activates the macro or
can you attach a macro to a button/shape inbedded in a form as before
activates when clicked.
The reason for asking is I have a macro to auto save a file using a selected
cell range and current date as file name to a chosen location within a shared
drive.
The idea being to make it more user friendly for those not to keen on IT.
Can any one help please!!
 
D

Don Guillett

right click sheet tab>view code>left window>worksheet>right window double
click

if target.address="$A$1" then call my macro
 
M

Marco

Thanks Don
But do i in the part ="$A$1" (put the cell loc i want to use to active the
macro)and in the part then call my macro (put the name of the macro to be
used in this case it is called SvMe

Marco
 
D

Don Guillett

right click sheet tab>view code>copy/paste this>test by double click on
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$A$1" Then Call mymacro
End Sub

Sub mymacro()
MsgBox "Hi there"
End Sub
 
G

Gord Dibben

How often do you want to save the workbook?

At intervals without closing?

If not, may be better to place event code in Thisworkbook which does the saving
when you close the workbook.


Gord Dibben MS Excel MVP
 
Top