MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Plotting a chart by using a macro


Posted by Christoph on August 31, 2001 1:47 AM

Hy there,
I got a problem and hope someone can help me.
I want to create a macro with which a chart is automatically plotted. No problem so far, but the range of cells selected (I mean the data source for the graph) should be a variable.
The column within my macro is:

Range("A3:E29").Select

Is it possible to include a function, so that I can choose the selected range upon every start of the macro???

Please help me!


Posted by Damon Ostrander on August 31, 2001 8:55 AM

Hi Cristoph,

You could have your macro pop up userform that asks you to enter the range in a reference box, but the easiest way is to simply select the range you want the chart to use before running the macro, and delete the line of code Range("A3:E29").Select in your recorded macro so that it doesn't change your selection. This assumes that your macro does not do any other selections prior to this point in the code that would override your manual selection.

Damon