View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hadi Sumoro Hadi Sumoro is offline
external usenet poster
 
Posts: 1
Default Series function& protect sheet in excel 2007

Dear all,

I am making an excel spreadsheet for 2007 and 2003. The way I am doing this
is making everything in excel 2007 and save is as excel 2003 (compatibility
mode). In the VBA, I wrote:

Quote:
Set Ser22 = ActiveSheet.ChartObjects("Chart 2").Chart.SeriesCollection(1)
Ser22.Values = Range(Cells(1, 25), Cells(n, 25))
Ser22.XValues = Range(Cells(1, 24), Cells(n, 24))
With ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlValue)
..MinimumScale = 0
..MaximumScale = Range("D16")
End With
With ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlCategory)
..MinimumScale = 0
..MaximumScale = Range("D15")
End With
The code above controls a chart where the n is total points (dots) that is
going to be plotted. The chart is XYscatter style (only dots, no lines).

I saved it, everything works very well!

I put a mouse scroll protection (vba code) on the sheet and protect the
sheet with password. All boxes contain formulas/results are not locked.

With the protection, this sheet works fine in excel 2003, however, excel
2007 says error for:

Quote:
Ser22.Values = Range(Cells(1, 25), Cells(n, 25))
It said:

Quote:
Run-time error '-2147467259 (80004005)':

Method 'Values' of object 'Series' failed
Is this a bug in excel 2007? I know that I am going to save this worksheet
as excel 2007 (.xlsm I guess if I am not mistaken with the file name), but
how do I make this working?

I also made a copy and converted the new copy to 2007 version (.xlsm), it
seems that the problem still exists. I really do not have any ideas how to
solve this problem.

Please help and advice. Thank you in advance.