View Full Version : Create Chart using VBA function
jan.zilka
10-16-2008, 02:00 AM
What's wrong with the following function? Excel ignore command to create a chart. Why?
Function MyFunc() As String
Charts.Add
MyFunc = ""
End Function
Using Sub Procedure is everything OK. :(
Sub MySub()
Charts.Add
End Sub
Thank you for your help.
Bob Phillips
10-16-2008, 02:19 AM
If you are trying to use this function in a worksheet, no go! UDFs cannot change things, just return a result.
jan.zilka
10-16-2008, 06:18 AM
If you are trying to use this function in a worksheet, no go! UDFs cannot change things, just return a result.
It's very easy to add line and change it. What's the different between object line and chart in sheet? What else UDF can change or create?
Function MyFunc() As String
Worksheets(1).Shapes.AddLine(50, 50, 100, 100).Select
Selection.ShapeRange.Line.ForeColor.SchemeColor = 10
MyFunc = ""
End Function
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.