Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there
I'm trying to remove all dimensions from a chart using a macro but I don't want to remove 2 specific dimensions.
I have this code that removes all dimensions:
set chart = ActiveDocument.GetSheetObject("CH01")
'clean chart
set dims = chart.GetProperties.Dimensions
set exps = chart.GetProperties.Expressions
for i=0 to dims.Count
chart.RemoveDimension 0
next
I thought I could just put an if statement within the for loop to skip the remove for my desired dimensions but I can't work out the syntax, please can anyone advise?
Cheers
Hi
Please try the following code
set chart = ActiveDocument.GetSheetObject("CH01")
'clean chart
set dims = chart.GetProperties.Dimensions
set exps = chart.GetProperties.Expressions
j = 0
for i=0 to dims.Count
if Condition Then
chart.RemoveDimension j
else
j = j + 1
end if
next
Cheers
Darius
Hi thanks for answering - I can see where you're going but what would the syntax for "Condition" be? For instance if I don't wnat to remove a dimension called "Name"? Thanks