Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro stops before beginning.

I receive this message:

"I cannot found method or data member"

I hope it is clear because I'm working with Italian VBA for excel and I
translated the message literally.

Ciao Alex.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Macro stops before beginning.

Hi Alex
you may post the relevant part of your code which causes this error

--
Regards
Frank Kabel
Frankfurt, Germany


y wrote:
I receive this message:

"I cannot found method or data member"

I hope it is clear because I'm working with Italian VBA for excel and
I translated the message literally.

Ciao Alex.


  #3   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro stops before beginning.

Here it is:

Sub Macro4_2()

Dim sArea, sXValues As Range
Dim i As Integer
Dim Nseries As Integer
Dim myChart As Chart
Dim sSTR As String

Set sArea = Application.InputBox(prompt:="Select range:", Type:=8)
Rem MsgBox sArea.Address
Set sXValues = Application.InputBox(prompt:="Select XValues:", Type:=8)
Set sYValues = Application.InputBox(prompt:="Select YValues:", Type:=8)

Rem MsgBox "=Foglio1!" & sXValues.Offset(i - 1, 0).Resize(1, sArea.Columns.Count).Address
Rem Stop
Nseries = sArea.Rows.Count - 1
Set myChart = Charts.Add
With myChart
Rem .SetSourceData Source:=sArea
.Name = "Pippo"
Rem For i = 1 To Nseries
Rem .SeriesCollection.NewSeries
Rem Next
.Sheets("Foglio1").Activate
i = 1
For Each c In .SeriesCollection
sSTR = "=Foglio1!" & sArea.Offset(i - 1, 0).Resize(1, sArea.Columns.Count).Address
MsgBox sSTR
c.Values = sSTR
c.Name = "=Foglio1!" & sYValues(i)
c.XValues = sXValues
i = i + 1
Next
.ChartType = xlSurface
End With
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Macro stops before beginning.

Hi
just some first notes without testing the functionality:
1. Add the line
Option Explicit
at the beginning of your module. You have some variables which are not
defined (e.g. 'c' and sYValues)

2. The first varriable declaration 'Dim sArea, sXValues As Range' only
defines the second variable as range. The first 'sArea' is defined as
variant. You may use 'Dim sArea as range, sXValues As Range'

3. The line
..Sheets("Foglio1").Activate
is not allowed within this 'with' statement. You probably meant
Sheets("Foglio1").Activate
Additonal note: There's probably no need to activate the sheet. Just
set an object reference to this sheet and use this reference






--
Regards
Frank Kabel
Frankfurt, Germany


y wrote:
Here it is:

Sub Macro4_2()

Dim sArea, sXValues As Range
Dim i As Integer
Dim Nseries As Integer
Dim myChart As Chart
Dim sSTR As String

Set sArea = Application.InputBox(prompt:="Select range:",
Type:=8) Rem MsgBox sArea.Address
Set sXValues = Application.InputBox(prompt:="Select XValues:",
Type:=8) Set sYValues = Application.InputBox(prompt:="Select
YValues:", Type:=8)

Rem MsgBox "=Foglio1!" & sXValues.Offset(i - 1, 0).Resize(1,
sArea.Columns.Count).Address Rem Stop
Nseries = sArea.Rows.Count - 1
Set myChart = Charts.Add
With myChart
Rem .SetSourceData Source:=sArea
.Name = "Pippo"
Rem For i = 1 To Nseries
Rem .SeriesCollection.NewSeries
Rem Next
.Sheets("Foglio1").Activate
i = 1
For Each c In .SeriesCollection
sSTR = "=Foglio1!" & sArea.Offset(i - 1, 0).Resize(1,
sArea.Columns.Count).Address MsgBox sSTR
c.Values = sSTR
c.Name = "=Foglio1!" & sYValues(i)
c.XValues = sXValues
i = i + 1
Next
.ChartType = xlSurface
End With
End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro stops before beginning.



Frank Kabel wrote:

Hi
just some first notes without testing the functionality:
1. Add the line
Option Explicit
at the beginning of your module. You have some variables which are not
defined (e.g. 'c' and sYValues)

2. The first varriable declaration 'Dim sArea, sXValues As Range' only
defines the second variable as range. The first 'sArea' is defined as
variant. You may use 'Dim sArea as range, sXValues As Range'

3. The line
.Sheets("Foglio1").Activate
is not allowed within this 'with' statement. You probably meant
Sheets("Foglio1").Activate
Additonal note: There's probably no need to activate the sheet. Just
set an object reference to this sheet and use this reference


Thanks Frank, I activate the sheet to compare the msg in msgbox with the data spread in the sheet.

Thanks, Alex.



  #6   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Macro stops before beginning.

When I use c in

"for each c in ..."

what kind of type I must declare for c?
Thanks, Alex

Frank Kabel wrote:

Hi


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Macro stops before beginning.

Hi
as the object you loop through or as variant

--
Regards
Frank Kabel
Frankfurt, Germany


y wrote:
When I use c in

"for each c in ..."

what kind of type I must declare for c?
Thanks, Alex

Frank Kabel wrote:

Hi

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Macro stops before beginning.

Hi,

For an example, if For Each c In .SeriesCollection

we define c as Series, since each item in SeriesCollection is a Series.

Does that answer your question?

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

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
Opening a file stops a Macro Bob Myers Excel Worksheet Functions 2 January 8th 08 11:50 PM
Macro repeats and then stops Sabba Efie Excel Discussion (Misc queries) 2 August 15th 06 11:03 PM
Vb macro stops when I try to create more than 89 charts Tiberius Charts and Charting in Excel 0 January 19th 06 05:52 PM
macro stops midstream dvt[_2_] Excel Programming 3 February 23rd 04 03:46 PM
Macro stops when another workbook is open Robert McMahon Excel Programming 1 September 24th 03 10:26 PM


All times are GMT +1. The time now is 05:38 AM.

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"