LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default de-link *dates* in chart from data

For the archives, the OP replied to me off line -

"
I tried out the code you posted on microsoft.public.excel.programming, and
it did the trick! interestingly enough I don't seem to need to use
ApplyAxisFormats. using GetAxisFormats before delinking alone seems to do
the trick and leave my dates in their normal format after delinking. I'm not
sure why that is.
"

and I replied back -

"
In that case all you need do is to loop each axis, or simply the axis you
are concerned with, and change this property -

.NumberFormatLinked = False

You probably don't need a separate function to do only this.

The code I posted was a partial snippet to cater for unknown potential
formats, also for delinking in different ways.
"

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
I have a delink chart addin that converts series X & Y values to arrays

and
other links to text. Or as a separate method, copies data linked to

another
workbook into same workbook.

Here's a snippet to handle axis formats such as dates

In the main routine

Dim ch as Chart
Dim vaAxis

set ch = whatever chart

before delinking
GetAxisFormats ch, vaAxis

code to delink

after delinking
ApplyAxisFormats ch vaAxis

Function GetAxisFormats(ch As Chart, va)
Dim ax As Axis
Dim i As Long
On Error Resume Next
ReDim va(0 To ch.Axes.Count, 0 To 2)
For Each ax In ch.Axes
With ax.TickLabels
va(i, 0) = .AutoScaleFont
va(i, 1) = .NumberFormat
va(i, 2) = .Orientation ' doesn't return "degree" in Xaxis
.NumberFormatLinked = False ' ?
End With
i = i + 1
Next

End Function

Function ApplyAxisFormats(ch As Chart, va)
Dim ax As Axis
Dim i As Long

For Each ax In ch.Axes
With ax.TickLabels
If Len(va(i, 0)) Then .AutoScaleFont = va(i, 0)
If Len(va(i, 1)) Then .NumberFormat = va(i, 1)
If Len(va(i, 2)) Then .Orientation = va(i, 2)
End With
i = i + 1
Next
End Function

Doing similar for labels is somewhat more complicated as only a string is
returned. I have something that seems to work for dates in labels but not
got around to fully testing.

FWIW the addin is geared to delink large qty's of values (limited to 5000

X
or Y values per series in XL97 & XL2K with array method). If interested I
can send you a copy.

Regards,
Peter T
pmbthornton gmail com



"Edward Scott" wrote in message
oups.com...
I have excel vba code that creates a chart from a table of data, then
de-links the chart from the data and removes the data, as described
he http://peltiertech.com/Excel/ChartsH...ChartData.html
(scroll down to the VBA bit).


The problem with this is that the x-labels on my chart are dates, and
when I de-link them the x-labels become apparently meaningless numbers.
I have almost torn my hair out trying to fix this, but I have not found
a solution.


I know this has been discussed before, he


http://groups.google.com/group/micro...ing/browse_thr
ead/thread/3440c5d45d534e92
and he


http://groups.google.com/group/micro...ing/browse_thr
ead/thread/5853113c57ea33aa

but no solution appears to have been mentioned in the past. I figured I
would check again to see if any ideas were out there.





 
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
Chart Title Link to Data Table GasGal Charts and Charting in Excel 1 March 6th 09 12:09 AM
How do I link data to a chart from multiple worksheets? Donna Charts and Charting in Excel 1 October 10th 08 05:35 PM
How do I keep chart/data link when copying worksheet Andy at Trinity Charts and Charting in Excel 7 July 10th 07 08:24 PM
How do you link chart source data when you copy the chart? mamagirl Charts and Charting in Excel 1 December 8th 06 02:40 AM
How do I create a link between columns from a data chart? Sara Excel Discussion (Misc queries) 1 June 2nd 06 06:51 PM


All times are GMT +1. The time now is 11:43 PM.

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"