A Tricky Question! Macro & Chart

H

hce

Hi All

I have a very tricky problem here. I have a column chart which has sa
4 columns - namely, A, B, C and D.

First Issue - I would like to check is it possible to assign a specifi
macro for A, B, C, and D to their respective columns?

Second Issue - And as each macro has its own codes, would it b
possible for the macro to be so smart that if I click on the column fo
A, A macro will run...

Please note that the order of the columns will change over time as
will sort the values and put the one with the highest value as th
first column.

Kindly advice me whether the above are possible...

Thanks in advance..
 
D

Don Guillett

This might work to double click the column desired.
Right click sheet tab>view code>copy paste this>

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Select Case Target.Column
Case 1: Call m1
Case 2: Call m2
Case Else
End Select
End Sub
 
E

Earl Kiosterud

Hce,

Your chart doesn't seem to be a chart in the Excel sense (column chart, line
chart, etc), but a table in a worksheet.

A macro can be set up as an event macro to run whenever you click in any
area of a sheet, such as in a column. So, yes, there could be four separate
macros, each running when its respective column was clicked. The
Worksheet_Selection event macro would be fired when any cell was clicked,
and it would examine the Target (the cell you clicked) to see which area was
clicked.

Tell us what you want done by the macros. Perhaps there are other
solutions.
 
H

hce

Hi

Sorry if my message was not clear enough...

I have attached a copy of what I want to do...

In Scenario 1, I have the chart plotted... and there r four button
below each bar... and when I click on Macro A for Bar A, Macro A shoul
run...

However, in Scenario 2, I still have the same 4 bars but the order o
the bars have changed due to a change in the values... Hence, Macro
originally was the first macro should be now in another position
where Bar A is...

My problem here is that I would have to move the buttons/macros t
their right position everytime when there's a change in the order...

Hope the attached info is clear enough...

Thank you for your interest...

Cheer

Attachment filename: chart.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=64288
 
E

Earl Kiosterud

hce,

Attachments get stripped. Perhaps you can describe the situation. Or you
may send it to the heavily encrypted (<g>) email address below, and I'll
take a look.

It seems that whatever changed the order of your data points should leave
some kind of flag somewhere so the macro buttons know which is in which
position. What is changing them?
 
D

Don Guillett

Earl, If desired you may click on the link and download from there. I
downloaded this but didn't have time to play with it. I still think my
original idea can work.

--
Don Guillett
SalesAid Software
(e-mail address removed)
Earl Kiosterud said:
hce,

Attachments get stripped. Perhaps you can describe the situation. Or you
may send it to the heavily encrypted (<g>) email address below, and I'll
take a look.

It seems that whatever changed the order of your data points should leave
some kind of flag somewhere so the macro buttons know which is in which
position. What is changing them?
 
H

hce

Hi Don

Pardon me if I'm wrong here... I thought the code that you suggeste
would only work on the cells... Would it still work on a chart...?

Cheers
kelvi
 
E

Earl Kiosterud

hce,

It appears that you have a column containing A, B, C, D, and four numbers
next door, plotted on a column chart. There are four buttons under each
chart column, Macro 1, Macro 2, etc. If the cells are rearranged, e.g.: B,
A, C, D, you want the buttons to become Macro 2, Macro 1.... Is that
correct?

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

Don Guillett said:
Earl, If desired you may click on the link and download from there. I
downloaded this but didn't have time to play with it. I still think my
original idea can work.
 

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

Top