What is 'Me'...?? I don't get what it is referring to in this subwhere it's changing the point's bor

R

R Tanner

What is 'Me'...?? I don't get what it is referring to in this sub
where it's changing the point's border color...

Private Sub Chart_SeriesChange(ByVal SeriesIndex As Long, _
ByVal PointIndex As Long)
Set p = Me.SeriesCollection(SeriesIndex).Points(PointIndex)
p.Border.ColorIndex = 3
End Sub
 
S

Susan

Me, in this case, is the chart.
sometimes it's a sheet, sometimes it's a userform.
hope that helps
susan
 
R

R Tanner

Me, in this case, is the chart.
sometimes it's a sheet, sometimes it's a userform.
hope that helps
susan

How should I know it is the chart? Just by the fact that it is the
parent object here?? Thank you for clarifying Susan.
 
A

Andy Pope

Hi,

Me is a keyowrd that refers to the object where the code is placed.
In your code ME is the activechart.

If your code was within a userform the ME would refer to the userform
object.


The help file actually says:

The Me keyword behaves like an implicitly declared variable. It is
automatically available to every procedure in a class module. When a
class can have more than one instance, Me provides a way to refer to the
specific instance of the class where the code is executing. Using Me is
particularly useful for passing information about the currently
executing instance of a class to a procedure in another module.

Cheers
Andy
 
S

Susan

yes, it's whatever object you're currently working with/in. if you
were working in a userform, Me would be the userform. if you were
working with objects on a worksheet, Me could be the worksheet. it's
just a shorthand way of referring to the object. if you prefer, you
could write it out (although with a chart i'm not sure how you'd refer
to it):

instead of

Me Unload (unloading a userform)

you could have

Userform1 Unload

i guess it's a matter of preference, but you get used to what it's
referring to.
susan
 
H

Harald Staff

If the code that says "me" is resding in a userform module, then Me is the
userform in question. If however it is written in a worksheet module then Me
is the spesific worksheet. If it is in the thisworkbook module then Me is
this workbook.

If you do object oriented programming, with, say, multiple instances of
Userform1, then Me refers to this (as in clicked, activated, .. ) single
instance and not the whole bunch of them.

HTH. Best wishes Harald
 
R

R Tanner

oh okay cool....Thanks...:)

I have one other question, if you can explain it to me...without too
much effort(I'm just learning and I'm trying to write a charting
userform that is a little out of my league at present lol)

In the following code, the 'ubound' syntax is simply being used to
count the number of values in the series? And why isn't there a set
statement or [dynamic]array used to identify the series in the chart
object?

I hope the fact I don't know these things doesn't make me seem
hopelessly lost!


Sub modifyseries()
Dim cht As Chart
Dim i As Long, v As Variant
Dim sr As series
Dim bc As Long

Set cht = Sheets("Sheet4").ChartObjects("Chart 2").Chart
bc = cht.ChartArea.Format.Fill.ForeColor.RGB
For Each sr In cht.SeriesCollection
sr.Border.LineStyle = xlAutomatic
For i = 1 To UBound(sr.Values)
If IsError(v) Then v = 0
If v = 0 Then
With series.Points(i)
.ApplyDataLabels Type:=xlDataLabelsShowNone
.Delete
End With
End If

Next i
Next sr


End Sub
 
D

Dave Peterson

This looks like an event on a chart sheet.

If that's true, this means that Me refers to the chart sheet that actually holds
the chart--not the chart itself.

Add a line like:
msgbox me.name
and it may help.
 
B

Bob Phillips

Actually it is

Unload Me

--
__________________________________
HTH

Bob

yes, it's whatever object you're currently working with/in. if you
were working in a userform, Me would be the userform. if you were
working with objects on a worksheet, Me could be the worksheet. it's
just a shorthand way of referring to the object. if you prefer, you
could write it out (although with a chart i'm not sure how you'd refer
to it):

instead of

Me Unload (unloading a userform)

you could have

Userform1 Unload

i guess it's a matter of preference, but you get used to what it's
referring to.
susan
 

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