Attach macro to a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!!
 
right click sheet tab>view code>left window>worksheet>right window double
click

if target.address="$A$1" then call my macro
 
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top