Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default How do you get a Selected Range address into a variable?

I am relatively new to Excel programming. I am trying to
generate an Excel chart with different data ranges.
I've been able to select a range of cells for the data
that I want to Chart

--Range(Selection, Selection.End(xlDown)).Select--

I was trying to store the address into a variable to be
used later, i.e.,
--DataRange = Selection.Address--

I was going to use this variable to put into

--ActiveChart.SetSourceData Source:=DataRange _
, PlotBy:=xlColumns

But it generates an error stating that '.Address' is an
invalid property of Selection.

I've been trying all kinds of different objects and
properties for over 3 hours. It seems like a simple thing
to do. But.......Help

Jack


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default How do you get a Selected Range address into a variable?

Jack;

If I understand you just leave off the .address and use
selection by itself.

Thanks,

Greg
-----Original Message-----
I am relatively new to Excel programming. I am trying to
generate an Excel chart with different data ranges.
I've been able to select a range of cells for the data
that I want to Chart

--Range(Selection, Selection.End(xlDown)).Select--

I was trying to store the address into a variable to be
used later, i.e.,
--DataRange = Selection.Address--

I was going to use this variable to put into

--ActiveChart.SetSourceData Source:=DataRange _
, PlotBy:=xlColumns

But it generates an error stating that '.Address' is an
invalid property of Selection.

I've been trying all kinds of different objects and
properties for over 3 hours. It seems like a simple thing
to do. But.......Help

Jack


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How do you get a Selected Range address into a variable?


I tried this:

Range(Selection, Selection.End(xlDown)).Select
DataRange = Selection

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Range(DataRange) _
, PlotBy:=xlColumns


I got: Method 'Range' of Object '_Global' failed

-----Original Message-----
try this:Source:=range(DataRange)
"Jack" дÈëÓʼþ
...
I am relatively new to Excel programming. I am trying to
generate an Excel chart with different data ranges.
I've been able to select a range of cells for the data
that I want to Chart

--Range(Selection, Selection.End(xlDown)).Select--

I was trying to store the address into a variable to be
used later, i.e.,
--DataRange = Selection.Address--

I was going to use this variable to put into

--ActiveChart.SetSourceData Source:=DataRange _
, PlotBy:=xlColumns

But it generates an error stating that '.Address' is an
invalid property of Selection.

I've been trying all kinds of different objects and
properties for over 3 hours. It seems like a simple

thing
to do. But.......Help

Jack




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How do you get a Selected Range address into a variable?

Greg

I tried this:

Range(Selection, Selection.End(xlDown)).Select
DataRange = Selection

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Range(DataRange) _
, PlotBy:=xlColumns


I got: Method 'Range' of Object '_Global' failed

Jack

-----Original Message-----
Jack;

If I understand you just leave off the .address and use
selection by itself.

Thanks,

Greg
-----Original Message-----
I am relatively new to Excel programming. I am trying to
generate an Excel chart with different data ranges.
I've been able to select a range of cells for the data
that I want to Chart

--Range(Selection, Selection.End(xlDown)).Select--

I was trying to store the address into a variable to be
used later, i.e.,
--DataRange = Selection.Address--

I was going to use this variable to put into

--ActiveChart.SetSourceData Source:=DataRange _
, PlotBy:=xlColumns

But it generates an error stating that '.Address' is an
invalid property of Selection.

I've been trying all kinds of different objects and
properties for over 3 hours. It seems like a simple

thing
to do. But.......Help

Jack


.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How do you get a Selected Range address into a variable?

Ialso tried this:
I tried this:

Range(Selection, Selection.End(xlDown)).Select
set DataRange = Selection

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Range(DataRange) _
, PlotBy:=xlColumns


I got: Method 'Range' of Object '_Global' failed at this
last statement.

Jack


-----Original Message-----
or this:
dim DataRange as range
set DataRange=selection 'or else
'or set datarange=rane("...")
....
Source:=DataRange
"Jack" дÈëÓʼþ
...
I am relatively new to Excel programming. I am trying to
generate an Excel chart with different data ranges.
I've been able to select a range of cells for the data
that I want to Chart

--Range(Selection, Selection.End(xlDown)).Select--

I was trying to store the address into a variable to be
used later, i.e.,
--DataRange = Selection.Address--

I was going to use this variable to put into

--ActiveChart.SetSourceData Source:=DataRange _
, PlotBy:=xlColumns

But it generates an error stating that '.Address' is an
invalid property of Selection.

I've been trying all kinds of different objects and
properties for over 3 hours. It seems like a simple

thing
to do. But.......Help

Jack




.



  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How do you get a Selected Range address into a variable?

Hi again.

I tried the first approach:
DataRange = Selection.address
.....
ActiveChart.SetSourceData Source:=Range(datarange) '!!

and I still got the same error.

However, using your 2nd suggestion:
set DataRange=selection
ActiveChart.SetSourceData Source:=datarange '!!
This indeed did work!!!! Glory be!

I don't understand why the 1st approach did not work.

I really appreciate your time and effort in helping me.
You guys that respond to our silly issues in these
discussion groups are really great.

I have never been disappointed.

Thanks

Jack


-----Original Message-----

дÈëÓʼþ
...
DataRange = Selection.address
....
ActiveChart.SetSourceData Source:=Range(datarange) '!!

or
dim DataRange as range
set DataRange=selection
ActiveChart.SetSourceData Source:=datarange '!!
I tried this:

Range(Selection, Selection.End(xlDown)).Select
DataRange = Selection

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Range(DataRange) _
, PlotBy:=xlColumns


I got: Method 'Range' of Object '_Global' failed

-----Original Message-----
try this:Source:=range(DataRange)
"Jack" дÈëÓʼþ
...
I am relatively new to Excel programming. I am trying

to
generate an Excel chart with different data ranges.
I've been able to select a range of cells for the data
that I want to Chart

--Range(Selection, Selection.End(xlDown)).Select--

I was trying to store the address into a variable to be
used later, i.e.,
--DataRange = Selection.Address--

I was going to use this variable to put into

--ActiveChart.SetSourceData Source:=DataRange _
, PlotBy:=xlColumns

But it generates an error stating that '.Address' is an
invalid property of Selection.

I've been trying all kinds of different objects and
properties for over 3 hours. It seems like a simple

thing
to do. But.......Help

Jack




.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a range address with ADDRESS function? Steve McLeod Excel Worksheet Functions 1 December 18th 08 02:02 PM
Variable Address in FROM WEB tool? [email protected] Excel Discussion (Misc queries) 0 April 23rd 08 06:38 AM
Inputbox to return address of cell selected by mouse D.S.[_2_] Excel Programming 2 October 25th 03 06:48 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"