Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Excel--Macro to label scatter plot.

11 views
Skip to first unread message

Jeff Bangert

unread,
Nov 21, 1992, 7:20:19 PM11/21/92
to
Is it possible to write a macro which will automatically label the
points in a scatter plot?

What I would like to do is define a range which includes a column of
labels, a column of x values, and a column of y values. Then, when
the macro is run, it would produce a scatter plot with each point
labeled with a text box. It would be ok with me if the labels
overlapped. I could always adjust them by hand.

Thanks for the help,

--
Jeff Bangert je...@kuhub.cc.ukans.edu
Computer Center je...@ukanvax.bitnet
University of Kansas
Lawrence, KS 66045
(913)864-0466

Joel Spolsky

unread,
Nov 23, 1992, 9:34:40 PM11/23/92
to
In article <1992Nov21.1...@kuhub.cc.ukans.edu> je...@kuhub.cc.ukans.edu (Jeff Bangert) writes:
>Is it possible to write a macro which will automatically label the
>points in a scatter plot?
>
>What I would like to do is define a range which includes a column of
>labels, a column of x values, and a column of y values. Then, when
>the macro is run, it would produce a scatter plot with each point
>labeled with a text box. It would be ok with me if the labels
>overlapped. I could always adjust them by hand.


Yeah, it's pretty easy too. Suppose Sheet1 looks like this:

label x y
a 1 1
b 2 2
c 3 3

Now you create a default scatter chart based on that using the charting
wizard. Activate the chart (double click on it so it comes up in its
own window) and run the following macro (which assumes 3 data points -
change the constant in the second line to fix that).

LabelScatterPoints (a)
=FOR("i",1,3)
= ATTACH.TEXT(4,1,i)
= FORMULA(OFFSET(Sheet1!$A$1,i,0))
=NEXT()
=RETURN()

--
Joel Spolsky
Program Manager
Microsoft Excel
joe...@microsoft.com

0 new messages