Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Rectangle that activates a macro

I have a macro assigned to a number of rectangles. When a
specific rectangle is clicked to activate the macro, I
need the macro to identify which rectangle (ex: "Rectangle
3") was clicked to activate the macro.
How would I do that?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Rectangle that activates a macro

Assign the macro to that rectangle


Public Sub Rec_click()
Dim sname as String
Dim rec as Rectangle

sName = application.caller
set rec = activeSheet.Rectangels(sName)
msgbox rec.Name
End Sub

--
Regards,
Tom Ogilvy


wrote in message
...
I have a macro assigned to a number of rectangles. When a
specific rectangle is clicked to activate the macro, I
need the macro to identify which rectangle (ex: "Rectangle
3") was clicked to activate the macro.
How would I do that?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Rectangle that activates a macro

Take a look at Application.Caller..

Public Sub LotsOfCallers()
Dim sWhich As String
sWhich = Application.Caller
MsgBox sWhich
End Sub



In article ,
wrote:

I have a macro assigned to a number of rectangles. When a
specific rectangle is clicked to activate the macro, I
need the macro to identify which rectangle (ex: "Rectangle
3") was clicked to activate the macro.
How would I do that?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Rectangle that activates a macro

I would guess each rectangle has an on_click event so just pass some
indentifier as an arguement to your macro. Something like this
Private Sub Rectangle1_Click()
yourmacro "rec1"
End Sub
Private Sub Rectangle2_Click()
yourmacro "rec2"
End Sub

then for your macro

Sub yourmacro(WhichRectangle as String)
your code here
End Sub

the value WhichRectangle will tell you what was clicked to start your macro

Paul D

wrote in message
...
I have a macro assigned to a number of rectangles. When a
specific rectangle is clicked to activate the macro, I
need the macro to identify which rectangle (ex: "Rectangle
3") was clicked to activate the macro.
How would I do that?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
selection from dropdown list activates hyperlink jlind50 Excel Discussion (Misc queries) 1 June 5th 07 03:38 AM
Special Menu activates Web Toolbar BEEJAY Excel Discussion (Misc queries) 0 July 4th 06 01:40 PM
Delete a rectangle using a macro [email protected] Excel Discussion (Misc queries) 2 September 29th 05 08:21 PM
VB activates unwanted function Urban Excel Programming 3 July 6th 04 06:59 PM
Solver activates other worksheets - why? Ken Dahlberg Excel Programming 1 September 12th 03 06:05 PM


All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"