Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Subscript out of range error message

I am trying to run this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Charts("Milestone Chart").Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Text = Range("B3") & " " & Range("B4") & " - NLP2"
'"First Quarter Sales"
End With

Application.ScreenUpdating = False
If Target.Address() = "$B$3" Then
Call getMSaddress(Target)
ElseIf Target.Address() = "$B$4" Then
Call getMSaddress(Target)
End If
End Sub

but I am getting the error message on:
Charts("Milestone Chart").Activate

I don't know why this is since I named the chart "Milestone Chart". Any
ideas.
Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Subscript out of range error message

Worksheet change can't active objects. try this

Private Sub Worksheet_Change(ByVal Target As Range)

With Charts("Milestone Chart")
.HasTitle = True
.ChartTitle.Text = Range("B3") & " " & Range("B4") & " - NLP2"
'"First Quarter Sales"
End With

Application.ScreenUpdating = False
If Target.Address() = "$B$3" Then
Call getMSaddress(Target)
ElseIf Target.Address() = "$B$4" Then
Call getMSaddress(Target)
End If
End Sub




"Ayo" wrote:

I am trying to run this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Charts("Milestone Chart").Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Text = Range("B3") & " " & Range("B4") & " - NLP2"
'"First Quarter Sales"
End With

Application.ScreenUpdating = False
If Target.Address() = "$B$3" Then
Call getMSaddress(Target)
ElseIf Target.Address() = "$B$4" Then
Call getMSaddress(Target)
End If
End Sub

but I am getting the error message on:
Charts("Milestone Chart").Activate

I don't know why this is since I named the chart "Milestone Chart". Any
ideas.
Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Subscript out of range error message

This was what I had before. I changed it to:
Charts("Milestone Chart").Activate
With ActiveChart

when because I was getting the same error message.


"joel" wrote:

Worksheet change can't active objects. try this

Private Sub Worksheet_Change(ByVal Target As Range)

With Charts("Milestone Chart")
.HasTitle = True
.ChartTitle.Text = Range("B3") & " " & Range("B4") & " - NLP2"
'"First Quarter Sales"
End With

Application.ScreenUpdating = False
If Target.Address() = "$B$3" Then
Call getMSaddress(Target)
ElseIf Target.Address() = "$B$4" Then
Call getMSaddress(Target)
End If
End Sub




"Ayo" wrote:

I am trying to run this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Charts("Milestone Chart").Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Text = Range("B3") & " " & Range("B4") & " - NLP2"
'"First Quarter Sales"
End With

Application.ScreenUpdating = False
If Target.Address() = "$B$3" Then
Call getMSaddress(Target)
ElseIf Target.Address() = "$B$4" Then
Call getMSaddress(Target)
End If
End Sub

but I am getting the error message on:
Charts("Milestone Chart").Activate

I don't know why this is since I named the chart "Milestone Chart". Any
ideas.
Thanks.

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

You are very limited on the type of operations you can perform with a
worksheet change macro. It is really only inteded to change the value of the
cell where the change was made. You can read data from any location but you
can only write data to the worksheet where the change was made. You also
can't active cells on other worksheets or charts.

"joel" wrote:

Worksheet change can't active objects. try this

Private Sub Worksheet_Change(ByVal Target As Range)

With Charts("Milestone Chart")
.HasTitle = True
.ChartTitle.Text = Range("B3") & " " & Range("B4") & " - NLP2"
'"First Quarter Sales"
End With

Application.ScreenUpdating = False
If Target.Address() = "$B$3" Then
Call getMSaddress(Target)
ElseIf Target.Address() = "$B$4" Then
Call getMSaddress(Target)
End If
End Sub




"Ayo" wrote:

I am trying to run this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Charts("Milestone Chart").Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Text = Range("B3") & " " & Range("B4") & " - NLP2"
'"First Quarter Sales"
End With

Application.ScreenUpdating = False
If Target.Address() = "$B$3" Then
Call getMSaddress(Target)
ElseIf Target.Address() = "$B$4" Then
Call getMSaddress(Target)
End If
End Sub

but I am getting the error message on:
Charts("Milestone Chart").Activate

I don't know why this is since I named the chart "Milestone Chart". Any
ideas.
Thanks.

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
Error Message "Subscript our of range" gsmclang Excel Discussion (Misc queries) 1 April 5th 07 06:59 PM
Subscript out of range error - save copy error bg18461[_16_] Excel Programming 2 June 13th 06 04:53 PM
FileCopy Command Giving "Subscript Out of Range" Error Message Jim Hagan Excel Programming 2 June 15th 05 06:07 PM
Subscript Out Of Range Error Message Bob Umlas[_3_] Excel Programming 1 July 28th 04 07:00 PM
Subscript Out Of Range Error Message Tod Excel Programming 0 July 28th 04 06:24 PM


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