Jump to content
Sign in to follow this  

Excel Macro VBA question...

Recommended Posts



On Excel 2003, I can manually create a graphic with all empty fields as XValues and Values and then I record the macro, which gives for example :


ActiveChart.ChartType = xlXYScatterSmooth

ActiveChart.SetSourceData Source:=Sheets("Sheet1" ).Range("A2" )


ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R2C1:R5C1"

ActiveChart.SeriesCollection(1).Values = "=Sheet1!R2C2:R5C2"

ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"

But if I run that macro in an empty sheet, I get an error because there are no values. On Excel 2007, it will work and create a Serie without any dot and when you enter values after, the dots will appear.

Do you have any solution ?

By the way, I'm not looking to build a Excel macro, I'm doing that by AutoIt.

To simplify, let's say I want to create an empty sheet and a graphic that as X data from R2C1:R65536C1 and Y data from R2C2:R65536C2, then the graphic appear empty (no dots) and then when you enter values in Excel, the dots appear as it would do if there would already be initial values in at least one X field and one Y field.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this