Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Range Statement in chart

Hi.

I'm having trouble referring to the column when creating a chart. The
following statement will work, but the "W170" will actually be variable and I
don't know how to refer to the last column letter in the range statement. I
do have a variable called "lastColumn" that givese me the number of the last
column, but I don't know how to find the letter for the range statement. Can
someone tell me how to do this?

ActiveChart.SetSourceData Source:=Sheets("By Hour").Range("A1:W170"), PlotBy _
:=xlColumns

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Range Statement in chart


maybe this

Range(Cells(1, "A"), Cells(170, lastcolumn))
--


Gary


"Mike D." wrote in message
...
Hi.

I'm having trouble referring to the column when creating a chart. The
following statement will work, but the "W170" will actually be variable and I
don't know how to refer to the last column letter in the range statement. I
do have a variable called "lastColumn" that givese me the number of the last
column, but I don't know how to find the letter for the range statement. Can
someone tell me how to do this?

ActiveChart.SetSourceData Source:=Sheets("By Hour").Range("A1:W170"), PlotBy _
:=xlColumns



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 235
Default Range Statement in chart

You might try this . . . By using CurrentRegion your data range will
automatically expand and contract as data is added to removed. Then you
could do away with the "lastcolumn" variable.

ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("A1").CurrentRegion , PlotBy:=xlColumns

--
John Mansfield
http://cellmatrix.net





"Mike D." wrote:

Hi.

I'm having trouble referring to the column when creating a chart. The
following statement will work, but the "W170" will actually be variable and I
don't know how to refer to the last column letter in the range statement. I
do have a variable called "lastColumn" that givese me the number of the last
column, but I don't know how to find the letter for the range statement. Can
someone tell me how to do this?

ActiveChart.SetSourceData Source:=Sheets("By Hour").Range("A1:W170"), PlotBy _
:=xlColumns

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
IF STATEMENT Range Bee Excel Discussion (Misc queries) 5 July 30th 07 12:33 AM
range in an IF statement Dorothy J Excel Worksheet Functions 9 January 12th 07 07:44 PM
IF statement with a range ricky Excel Worksheet Functions 8 October 26th 06 06:32 PM
Use a range name in VB with IF Then Else statement spydor Excel Discussion (Misc queries) 1 January 6th 06 01:20 AM
Set range statement Mike Excel Programming 6 December 25th 03 06:45 PM


All times are GMT +1. The time now is 12:27 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"