Calculating Range Dynamically
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Calculating Range Dynamically

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Hello-

    I have a simple task that I need help with...

    I have a spreadsheet which imports data from a text file. The data can change, meaning that it can have 10 rows one day, perhaps 20 the other. I can calculate the number of rows using the following line of code...

    RowCount = WorksheetFunction.CountA(.Columns(1))

    Now I need to set the range for a chart based on the number of rows using SetSourceData.

    The range will always start at cell A1, how do I tell Excel to add the number from RowCount to the range for SetSourceData?

    Thanks-
    Thomas

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    rowcount = Range("a1").End(xlDown).Row
    ActiveSheet.ChartObjects("chart 2").Activate
    ActiveChart.SetSourceData Source:=Sheets("Sheet6").Range("A1:B" & rowcount), PlotBy:= _
    xlColumns

    <table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;"> DALEY :P </td></table>

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Ahmedabad Gujarat
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    There are different way where you can make your range dynamic.

    I have able to list some ways in my file no. 16 'Populating Combobox'

    see if it can be helpful to you.
    http://www.pexcel.com/download.htm
    ni****h desai
    http://www.pexcel.com



User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com