Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default Run-time error on command button

On a worksheet named Customer, is a command button (among
other command buttons) with a macro named "GoToMetric1"
assigned to it. The macro code is located in Module2 and
the code is:

Sub GoToMetric1()
Sheets("Metrics").Select
Range("A1").Select
ActiveSheet.ChartObjects("Chart 13").Activate
With ActiveChart.Parent
.Height = 660 '660 X 780 is landscape ratio 77%
(8 1/2" x 11")
.Width = 780
.Top = 10
.Left = 125
End With
End Sub

On a worksheet named Metrics, are various charts, with
Chart 13 displaying data.

The intent is when the user clicks on the command button,
Chart 13 (among other charts) on the Metrics worksheet
comes up; however, I'm getting a run-time error '1004':
Activate method of ChartObject class failed. Can someone
help me correct this error?

There is also an Auto Open routine being run when the
workbook opens, located in Module1, with the following
code:

Sub Auto_Open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select
Application.GoTo ws.Range("A1"), True
ActiveWindow.DisplayGridlines = False
End If
Next
Worksheets("Scorecard").Select
ThisWorkbook.Colors(7) = RGB(255, 124, 128)
Application.AutoPercentEntry = True
Application.ScreenUpdating = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Run-time error on command button

Try to re-write your code this way:

Sub GoToMetric1()
With Charts("Chart 13")
.Height = 660
.Width = 780
.Top = 10
.Left = 125
.Activate
End With
End Sub

Make sure that the chart named "Chart 13" exists.

Good luck -
RADO


"Phil Hageman" wrote in message
...
On a worksheet named Customer, is a command button (among
other command buttons) with a macro named "GoToMetric1"
assigned to it. The macro code is located in Module2 and
the code is:

Sub GoToMetric1()
Sheets("Metrics").Select
Range("A1").Select
ActiveSheet.ChartObjects("Chart 13").Activate
With ActiveChart.Parent
.Height = 660 '660 X 780 is landscape ratio 77%
(8 1/2" x 11")
.Width = 780
.Top = 10
.Left = 125
End With
End Sub

On a worksheet named Metrics, are various charts, with
Chart 13 displaying data.

The intent is when the user clicks on the command button,
Chart 13 (among other charts) on the Metrics worksheet
comes up; however, I'm getting a run-time error '1004':
Activate method of ChartObject class failed. Can someone
help me correct this error?

There is also an Auto Open routine being run when the
workbook opens, located in Module1, with the following
code:

Sub Auto_Open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select
Application.GoTo ws.Range("A1"), True
ActiveWindow.DisplayGridlines = False
End If
Next
Worksheets("Scorecard").Select
ThisWorkbook.Colors(7) = RGB(255, 124, 128)
Application.AutoPercentEntry = True
Application.ScreenUpdating = True
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default Subscript out of range error

Hi RADO. Thanks for your reply. I entered your code
exactly as you have it here and now receive a run-time
error '9': "Subscript out of range." Is there more to
this?

Thanks, Phil
-----Original Message-----
Try to re-write your code this way:

Sub GoToMetric1()
With Charts("Chart 13")
.Height = 660
.Width = 780
.Top = 10
.Left = 125
.Activate
End With
End Sub

Make sure that the chart named "Chart 13" exists.

Good luck -
RADO


"Phil Hageman"

wrote in message
...
On a worksheet named Customer, is a command button

(among
other command buttons) with a macro named "GoToMetric1"
assigned to it. The macro code is located in Module2

and
the code is:

Sub GoToMetric1()
Sheets("Metrics").Select
Range("A1").Select
ActiveSheet.ChartObjects("Chart 13").Activate
With ActiveChart.Parent
.Height = 660 '660 X 780 is landscape ratio 77%
(8 1/2" x 11")
.Width = 780
.Top = 10
.Left = 125
End With
End Sub

On a worksheet named Metrics, are various charts, with
Chart 13 displaying data.

The intent is when the user clicks on the command

button,
Chart 13 (among other charts) on the Metrics worksheet
comes up; however, I'm getting a run-time error '1004':
Activate method of ChartObject class failed. Can

someone
help me correct this error?

There is also an Auto Open routine being run when the
workbook opens, located in Module1, with the following
code:

Sub Auto_Open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select
Application.GoTo ws.Range("A1"), True
ActiveWindow.DisplayGridlines = False
End If
Next
Worksheets("Scorecard").Select
ThisWorkbook.Colors(7) = RGB(255, 124, 128)
Application.AutoPercentEntry = True
Application.ScreenUpdating = True
End Sub



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Subscript out of range error

Most likely it means that you don't have a chart named "Chart 13"
Try this:

record a macro manually - just select your chart and stop recording. then
look at the macro code - what's the name of the chart? Send me a copy of the
macro if you like

RADO


"Phil Hageman" wrote in message
...
Hi RADO. Thanks for your reply. I entered your code
exactly as you have it here and now receive a run-time
error '9': "Subscript out of range." Is there more to
this?

Thanks, Phil
-----Original Message-----
Try to re-write your code this way:

Sub GoToMetric1()
With Charts("Chart 13")
.Height = 660
.Width = 780
.Top = 10
.Left = 125
.Activate
End With
End Sub

Make sure that the chart named "Chart 13" exists.

Good luck -
RADO


"Phil Hageman"

wrote in message
...
On a worksheet named Customer, is a command button

(among
other command buttons) with a macro named "GoToMetric1"
assigned to it. The macro code is located in Module2

and
the code is:

Sub GoToMetric1()
Sheets("Metrics").Select
Range("A1").Select
ActiveSheet.ChartObjects("Chart 13").Activate
With ActiveChart.Parent
.Height = 660 '660 X 780 is landscape ratio 77%
(8 1/2" x 11")
.Width = 780
.Top = 10
.Left = 125
End With
End Sub

On a worksheet named Metrics, are various charts, with
Chart 13 displaying data.

The intent is when the user clicks on the command

button,
Chart 13 (among other charts) on the Metrics worksheet
comes up; however, I'm getting a run-time error '1004':
Activate method of ChartObject class failed. Can

someone
help me correct this error?

There is also an Auto Open routine being run when the
workbook opens, located in Module1, with the following
code:

Sub Auto_Open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select
Application.GoTo ws.Range("A1"), True
ActiveWindow.DisplayGridlines = False
End If
Next
Worksheets("Scorecard").Select
ThisWorkbook.Colors(7) = RGB(255, 124, 128)
Application.AutoPercentEntry = True
Application.ScreenUpdating = True
End Sub



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Subscript out of range error

Phil,

try this:

Sub GoToMetric1()
With Sheets("Metrics").ChartObjects("Chart 13")
.Height = 660
.Width = 780
.Top = 10
.Left = 125
.Activate
End With
End Sub

Should work.

RADO

"Phil Hageman" wrote in message
...
Hi RADO. Thanks for your reply. I entered your code
exactly as you have it here and now receive a run-time
error '9': "Subscript out of range." Is there more to
this?

Thanks, Phil
-----Original Message-----
Try to re-write your code this way:

Sub GoToMetric1()
With Charts("Chart 13")
.Height = 660
.Width = 780
.Top = 10
.Left = 125
.Activate
End With
End Sub

Make sure that the chart named "Chart 13" exists.

Good luck -
RADO


"Phil Hageman"

wrote in message
...
On a worksheet named Customer, is a command button

(among
other command buttons) with a macro named "GoToMetric1"
assigned to it. The macro code is located in Module2

and
the code is:

Sub GoToMetric1()
Sheets("Metrics").Select
Range("A1").Select
ActiveSheet.ChartObjects("Chart 13").Activate
With ActiveChart.Parent
.Height = 660 '660 X 780 is landscape ratio 77%
(8 1/2" x 11")
.Width = 780
.Top = 10
.Left = 125
End With
End Sub

On a worksheet named Metrics, are various charts, with
Chart 13 displaying data.

The intent is when the user clicks on the command

button,
Chart 13 (among other charts) on the Metrics worksheet
comes up; however, I'm getting a run-time error '1004':
Activate method of ChartObject class failed. Can

someone
help me correct this error?

There is also an Auto Open routine being run when the
workbook opens, located in Module1, with the following
code:

Sub Auto_Open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select
Application.GoTo ws.Range("A1"), True
ActiveWindow.DisplayGridlines = False
End If
Next
Worksheets("Scorecard").Select
ThisWorkbook.Colors(7) = RGB(255, 124, 128)
Application.AutoPercentEntry = True
Application.ScreenUpdating = True
End Sub



.



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
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Command Button Error - Help Needed Urgently Please Salman Excel Worksheet Functions 2 March 7th 07 10:24 AM
run-time error '91'-Close Button error ASCO IS Help Excel Discussion (Misc queries) 1 May 8th 06 04:25 PM
How to create command button to save the dates and time Ken Vo Excel Discussion (Misc queries) 6 January 5th 06 04:18 AM
How can i use a command button to validate date and time kcdonaldson Excel Discussion (Misc queries) 0 December 9th 05 04:03 PM


All times are GMT +1. The time now is 09:47 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"