largeselection
Active Member
- Joined
- Aug 4, 2008
- Messages
- 358
So I'm almost there.
I'm using some stuff I found from Andrew Poulsom to add labels to a scatterplot based on the Ch_MouseDown event. The issue that I'm having is changing the reference in the text to a different cell.
Basically I want to pull back the UserID # which is in column B. So the code I'm using is:
This works well and puts at the end of the label the value of the cell in column B using the selected points index value as the row.
However, my serieses (sp?) are built based on values within the cells and are not sequential. I have tried to change the Range in the last row of the code to my defined range from the other part of code and I've tried to change it to the range of Xvalues, but nothing works.
I thought to use Range(XValues).Cells(b,1).value might work because when I recorded a macro (which I then used to help build the code that creates the ranges) the code I used was
so I thought if I could use that range (XValues) as the range in the last row of code I could pull the selected point's index from within that range (and thus the fact that my series are not in sequential row order would not be a problem)
Ideally I would want the text that it pulls back to read:
Assuming I clicked on SeriesCollection(1), Points(3). I would want it to throw back as my "label". The third point in that series' Xvalues address offset by -2.
So it would see that I clicked on 1st Series and 3rd point and it would look at the XValues range in that series and choose the 3rd point (in this case being = Sheet1!$D52), then offset by -2 and return the value in cell B52.
Sorry if this is confusing, but I'm at my wits end with this. I've tried every combo under the sun that I can think of and I keep getting sub undefined or doesn't support that method errors.
Any help/links would be greatly appreciated
I'm using some stuff I found from Andrew Poulsom to add labels to a scatterplot based on the Ch_MouseDown event. The issue that I'm having is changing the reference in the text to a different cell.
Basically I want to pull back the UserID # which is in column B. So the code I'm using is:
Code:
Private Sub Ch_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
Dim Txt As String
Txt = ""
Ch.GetChartElement x, y, IDNum, a, b
If IDNum = xlSeries Then
With ActiveChart.SeriesCollection(a).Points(b)
.HasDataLabel = True
Txt = "Series " & .Parent.Name
Txt = Txt & " point " & b
Txt = Txt & " (" & .DataLabel.Text & ")"
Txt = Txt & " - " & Range("B28:B128").Cells(b, 1).Value
This works well and puts at the end of the label the value of the cell in column B using the selected points index value as the row.
However, my serieses (sp?) are built based on values within the cells and are not sequential. I have tried to change the Range in the last row of the code to my defined range from the other part of code and I've tried to change it to the range of Xvalues, but nothing works.
I thought to use Range(XValues).Cells(b,1).value might work because when I recorded a macro (which I then used to help build the code that creates the ranges) the code I used was
Code:
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!$D25, Sheet1!$D45, Sheet1$D52, etc"
so I thought if I could use that range (XValues) as the range in the last row of code I could pull the selected point's index from within that range (and thus the fact that my series are not in sequential row order would not be a problem)
Ideally I would want the text that it pulls back to read:
Assuming I clicked on SeriesCollection(1), Points(3). I would want it to throw back as my "label". The third point in that series' Xvalues address offset by -2.
So it would see that I clicked on 1st Series and 3rd point and it would look at the XValues range in that series and choose the 3rd point (in this case being = Sheet1!$D52), then offset by -2 and return the value in cell B52.
Sorry if this is confusing, but I'm at my wits end with this. I've tried every combo under the sun that I can think of and I keep getting sub undefined or doesn't support that method errors.
Any help/links would be greatly appreciated