LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Changing a range number to a variable


I have the following line created in a macro that creates a new chart from my
table every day:

ActiveChart.SetSourceData Source:=Sheets("tbCurrency").Range("B1:B1540,M1:M1 540"), PlotBy:=xlColumns


However, each day I am adding 1 more row to my table, so I want my chart to
reflect the number of rows in the table - today it is 1540 rows, but it will
be 1541 rows tomorrow.

I have created a variable that calculates the last filled row in the table,
with the line below:

LastCol = Worksheets("tbCurrency").Range("A65536").End(xlUp) .Row

The only thing I can't figure out now is how to replace the 1540 with the
LastCol variable! I've tried quite a few permutations, but I can't get it
right. For example, things like this:

ActiveChart.SetSourceData Source:=Sheets("tbCurrency").Range("B1:B" & LastCol & ",M1:M" & LastCol), PlotBy:=xlColumns


but that didn't work. I'm sure it's really easy, but after trying all the
ways I can think of, and spending half a day on search engines, I'm willing
to let someone else show me how easy it is! :-)

Dave
 
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
Using named range to extend print area for variable number of columns Pierre Excel Worksheet Functions 3 April 10th 08 05:51 PM
Macro - Using a variable number of columns in a Range stumped Excel Discussion (Misc queries) 2 October 3rd 06 08:13 PM
Variable Determines Number of Cell in Formula Range MJSlattery Excel Worksheet Functions 0 March 30th 06 01:28 AM
Range("C9:V9").Select ==> changing the 9 to a variable B. F. Excel Worksheet Functions 8 May 23rd 05 01:16 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 04:23 PM.

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"