Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 11th, 2003, 04:15 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Variable data ranges for charts

Hi

I want to create a chart with the data range dependant on certain variables. have tried the following to no effect any ideas?


i.e. .Range(.cells(x,y),.cells(i,j))

I have tried several variations but none are accepted

The actual code line is:

ActiveChart.SetSourceData Source:=Sheets(Country(i, 1)).Range(Cells(2, 2), Cells(2, maxdate - 1987))

Any suggestions appreciated.
Reply With Quote
  #2 (permalink)  
Old June 12th, 2003, 02:18 AM
Authorized User
 
Join Date: Jun 2003
Location: , , Japan.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you getting an error message? If so, what?

Two things to check

1. Does Country(i,1) return a string or a long/integer corresponding to an existing sheet.

2. Is maxdate a date or a long/integer?
If date try ...., Cells(2,DatePart("yyyy",maxdate)-1987), also checking that the year of maxdate>=1989

Adding the following above the line should tell you which is the problem
Debug.Print Country(i, 1); maxdate
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on Hiding Charts with no data Wazar Excel VBA 4 December 19th, 2018 03:04 AM
Date Ranges nbuckwheat Access 1 December 12th, 2005 12:45 PM
Copying ranges mtowle Excel VBA 2 November 2nd, 2005 06:35 AM
date ranges yuqlin BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 December 23rd, 2004 05:23 PM
Variable data Ranges dgarcia1128 Excel VBA 3 June 20th, 2003 02:11 PM



All times are GMT -4. The time now is 08:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.