+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Printing charts from VB - How to define range?

    Hi,
    I am trying to write some code which prints a chart to an excel worksheet (see module in attached workbook). I have recorded a macro which does most of the work, and am trying to edit this so that I can make it into a loop. I am having some trouble with defining the range for input data (line 33 in Module2), it would be great if someone could show me the correct way.

    Thanks
    Attached Files Attached Files
    Last edited by HammerTime; 07-21-2009 at 08:31 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    10,938

    Re: Printing charts from VB - How to define range?

    You need to reference the sheet where the cells are

    Code:
        ActiveChart.SetSourceData Source:=Sheets("Salinity_Obs").Range(Sheets("Salinity_Obs").Cells(Iref, Jref), Sheets("Salinity_Obs").Cells(Iref + Rownum - 1, Jref + Colnum - 1)), _
            PlotBy:=xlColumns
    Cheers
    Andy
    www.andypope.info

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0