Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-19-2009, 08:48 PM
HammerTime HammerTime is offline
Registered User
 
Join Date: 14 Aug 2008
Location: Australia
MS Office Version:Excel 2003
Posts: 78
HammerTime is becoming part of the community
Printing charts from VB - How to define range?

Please Register to Remove these Ads

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
File Type: xls Mt William Crk Bore Data 14-7-09.xls (256.5 KB, 1 views)

Last edited by HammerTime; 07-21-2009 at 08:31 PM.
Reply With Quote
  #2  
Old 07-20-2009, 07:45 AM
Andy Pope's Avatar
Andy Pope Andy Pope is offline
Forum Guru
 
Join Date: 10 May 2004
Location: Essex, UK
MS Office Version:2003 & 2007 sp2
Posts: 7,183
Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding
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
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump