Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default VB Macros for Charts - Fails (Office 2003 on WInXP Sp2)

Hi,
Cant underatand why some plots go through fine, some fail....this is portion
of chart plotting. I didnt specifically want to include a huge vb macro in
here.
It fails at the line: Source:=Sheets(str2).Range("A1:A290,K1:K290,L1:L29 0")
saying subscr out of range.
My A, K and L cols have floating point data (in the form of XX.YY) and
values start from row#3. So, A(1,1) A(1,2) have column heading (string). Same
with K(1,1) K(1,2) and L(1,1) and L(1,2)
Sometimes it runs fine. I can plot. Everything is perfect. Some plots are a
problem. Don't know why. No data exceeds row# 290. Yes - I have checkd it a
hundred times... Thanks.

str2 is a string parameter Im passing from another macro. its basically a
filename and harmless. same with str3 and str1....if you find them.

....
.....
Range("A1").Select
Range("A1:A291").Select
Range("A1:A291,K1").Select
Range("K1").Activate

'Range("A1:A290,K1:K290,L1:L290").Select
'Range("A:A,K:L").Select
'Range("L1").Activate



Range("A1:A290,K1:K290,L1:L290").Select
Range("L1").Activate
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData
Source:=Sheets(str2).Range("A1:A290,K1:K290,L1:L29 0")


With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "xStat vs TMC (Average)"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Speed"
End With

'
ActiveWorkbook.SaveAs Filename:= _
str3, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False

.....
.....
.....




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default VB Macros for Charts - Fails (Office 2003 on WInXP Sp2)

What the error message is telling you is that it can't find a sheet named
str2. So whatever that variable equals is not recognized by VBA as a sheet
name nor index number. That is where your problem lies, not in the length of
the data in the columns.

"Deepak" wrote:

Hi,
Cant underatand why some plots go through fine, some fail....this is portion
of chart plotting. I didnt specifically want to include a huge vb macro in
here.
It fails at the line: Source:=Sheets(str2).Range("A1:A290,K1:K290,L1:L29 0")
saying subscr out of range.
My A, K and L cols have floating point data (in the form of XX.YY) and
values start from row#3. So, A(1,1) A(1,2) have column heading (string). Same
with K(1,1) K(1,2) and L(1,1) and L(1,2)
Sometimes it runs fine. I can plot. Everything is perfect. Some plots are a
problem. Don't know why. No data exceeds row# 290. Yes - I have checkd it a
hundred times... Thanks.

str2 is a string parameter Im passing from another macro. its basically a
filename and harmless. same with str3 and str1....if you find them.

...
....
Range("A1").Select
Range("A1:A291").Select
Range("A1:A291,K1").Select
Range("K1").Activate

'Range("A1:A290,K1:K290,L1:L290").Select
'Range("A:A,K:L").Select
'Range("L1").Activate



Range("A1:A290,K1:K290,L1:L290").Select
Range("L1").Activate
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData
Source:=Sheets(str2).Range("A1:A290,K1:K290,L1:L29 0")


With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "xStat vs TMC (Average)"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Speed"
End With

'
ActiveWorkbook.SaveAs Filename:= _
str3, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False

....
....
....




Reply
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
Linking Excel Charts to PowerPoint (Office 2003) valerie Excel Programming 0 March 8th 07 02:27 PM
Adding Excel charts to PowerPoint presentation in Office 2003 trooper665 Excel Programming 0 October 12th 05 05:03 PM
xyScatterChart macro works on WinXP Pro & not on WinXP Home? [email protected] Excel Discussion (Misc queries) 0 July 18th 05 12:30 AM
How do you install help for excel 4.0 macros in Office 2003? Macliam Excel Discussion (Misc queries) 9 February 4th 05 03:08 AM
Calling macros width arguments in winxp Isidro Vila Verde Excel Programming 2 October 31st 03 03:55 PM


All times are GMT +1. The time now is 11:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"