I need to produce separate charts showing 15, 30 and 60 minute increments.

rdkriner1962

New Member
Joined
May 8, 2018
Messages
2
I've written 3 macros to produce my charts. Only the hourly chart will run. the other two macros show an error for the 15 minute and 30 minute.
I'm not sure how to properly define the time for these two macros. I've tried quarter- and half-hourly ... I've tried using 15 minute and 30 minute.
The times, on the spreadsheet, are entered from 9:00 am to 9:30 pm(every half-hour).
I know there is something I am not seeing ... probably something simple that eludes me.

Run-time error '9'
Subscript out of range

This is the error message I receive.

Any assistance would be greatly appreciated.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi rdkriner1962

If you would like someone to assist you, please post your code using code tags [the hash tag symbol in the menu]. Otherwise no-one will be able to help you.

Cheers

pvr928
 
Last edited:
Upvote 0
This macro runs fine:

Sub CallCurve()
'
' Macro1 Macro
'


'
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Inbound Hourly Gate Stat Report").Select
Range("A2:E3").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
Sheets("Inbound Hourly Gate Stat Report").Select
Range("A22:E47").Select
Selection.Copy
Sheets("Sheet1").Select
Range("A2").Select
ActiveSheet.Paste
Range("A1:E27").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = Combo
ActiveChart.SetSourceData Source:=Range("Sheet1!$A$1:$E$27")
Columns("A:E").Select
Columns("A:E").EntireColumn.AutoFit
ActiveSheet.Shapes("Chart 1").IncrementLeft -254.25
ActiveSheet.Shapes("Chart 1").IncrementTop -240
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.Shapes("Chart 1").ScaleWidth 2.5520833333, msoFalse, msoScaleFromTopLeft
End Sub

This macro and my 15 minute macro don't:

Sub Macro2()
'
' CallCurve2
' Inbound HalfHour Gate Stat Report
'


'

Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Inbound HalfHour Stat Report").Select
Range("A2:E3").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
Sheets("Inbound HalfHour Gate Stat Report").Select
Range("A22:E47").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
Range("A2").Select
ActiveSheet.Paste
Range("A1:E27").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = Combo
ActiveChart.SetSourceData Source:=Range("Sheet1!$A$1:$E$27")
Columns("A:E").Select
Columns("A:E").Select
Columns("A:E").EntireColumn.AutoFit
ActiveSheet.Shapes("Chart1").IncrementLeft -254.25
ActiveSheet.Shapes("Chart1").IncrementTop -240
ActiveSheet.ChartObjects("Chart1").Activate
ActiveSheet.ChartObjects("Chart1").Activate
ActiveSheet.Shapes("Chart1").ScaleWidth 2.5520833333, msoFalse, msoScaleFromTopLeft





End Sub


Thank you pvr928 for the reminder that I forgot to post the code. :cool:
 
Upvote 0
Hi @rdkriner1962

Posting your code alone and saying 'my macro doesn't work' doesn't provide guidance on why you believe it is not working.

In what way is it not working? Do errors appear? If so, what are they? What line/s do they appear on?

The two macros you have posted appear at first glance to be identical. Is this intentional?

And once again, if you are posting code:

please post your code using code tags [the hash tag symbol in the menu].

Cheers

pvr928
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top