View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Macro to take cell ref of the object

What type of object do you have?

You need to go into design mode to assign a macro to an object

from worksheet menu

View - Tool Bars - Control toolbox, then click on triangle ICON enter design
mode.

Then either (depends on object)
1) Right click object and select Assign Macro. Then press New
2) Double click on Object which will automatically create the macro.

Next, enter the copy line (2nd line) from code below into the macro that was
created by excel.


Sub Picture2_Click()
Range("A1").Value = Range("D7").Value
End Sub


Finally, exit design mode by clicking on Triangular Icon in the toolbar.

"Kashyap" wrote:

Hi,

Say I have objects placed in Col c, d, e, f, g, h, i, j in row 8 and I need
to assign macro for each object such that

when I click on object which is in d8, then it should copy the value of d7
and paste in may be a1

when I click on object which is in e8, then it should copy the value of e7
and paste in may be a1 again.. and so on..

can anyone help me with this pls..

Thanks..