Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default VBA code for Range

I'm trying to create multiple charts via a macro in Excel 2007.
I'm getting a 1004 - Range of Object _Global Failed on the indicated statement. I believe I've done something wrong with the last Range in that statement, but I'm not sure what.

Sub OATChartCreate()

Dim chtNew As Chart
Dim i As Integer '<<<
ActiveCell.Resize(2.6).Select
ActiveSheet.Shapes.AddChart.Select
Set chtNew = ActiveChart
For i = 1 To 109 '<<<
Range("F1:K1,F2:K2").Select
Range("F2").Activate
ActiveCell.Resize(2.6).Select
ActiveSheet.Shapes.AddChart.Select
Set chtNew = ActiveChart
chtNew.SetSourceData Source:=Range( _

"'OAT Test Charts Data_Crosstab'!$F$1:$K$1, Range(ActiveCell,ActiveCell.Offset(0,6)).Select" _
) <<<
chtNew.ChartType = xlColumnClustered
chtNew.Legend.Delete
chtNew.HasAxis(xlValue) = True
chtNew.Axes(xlValue).MinimumScale = 0
chtNew.Axes(xlValue).MaximumScale = 1
chtNew.Axes(xlValue).MajorUnit = 0.1
chtNew.Axes(xlValue).MajorUnit = 0.2
chtNew.Axes(xlValue).TickLabels.NumberFormat = "0.00%"
chtNew.Axes(xlValue).TickLabels.NumberFormat = "0%"
ActiveChart.ChartArea.Select
chtNew.SetElement (msoElementPrimaryValueAxisTitleVertical)
chtNew.SetElement (msoElementChartTitleAboveChart)
chtNew.ChartTitle.Text = "Adams County - 8th Grade Mathematics Results"
chtNew.Axes(xlValue, xlPrimary).AxisTitle.Text = "Percent Passing"
Range("F2").Offset(i, 0).Select
Next i
End Sub

Thanks

Jef
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
Code to fax range? Webtechie Excel Programming 3 March 12th 10 11:57 AM
Range - using in code Stephanie Excel Worksheet Functions 5 June 24th 09 07:38 PM
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? [email protected] Excel Programming 4 May 29th 09 10:13 PM
VBA CODE range mikespeck Excel Worksheet Functions 0 August 8th 06 05:24 PM
VB Code Naming a Range (range changes each time) krazylain Excel Programming 4 May 15th 04 12:41 PM


All times are GMT +1. The time now is 09:39 PM.

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

About Us

"It's about Microsoft Excel"