PC Review


Reply
Thread Tools Rate Thread

Automate anonymysing of data in charts

 
 
Annie Whitley
Guest
Posts: n/a
 
      2nd Nov 2008
Hi everyone,

I’m hoping that someone can help me with some code to automate the
anonomysing of data in a chart and then changing bar colours and saving as a
new chart and returning to original chart and doing it again.

Each chart has 14 bars representing spend per budget centre and an
additional 2 bars for average depot spend and overall average company spend.

Data is on a separate sheet

C14:C29 holds budget centre code and D holds costs in £.

I’ve recorded a macro which adds a column to which I move budget centre data
(so costs are now in E) and then copy the data back for the 1 bar of interest
plus the two averages bars.
Then change colours as required and save to separate book.

What I need help with is all the elegant stuff that would return me to the
data and offset to the next set of data down and the next bar over.

Here’s my recorded macro – I know there will be lots in it that I don’t
need, but not confident enough to delete.

Sub Anonymise()

Range("C14:C29").Select
Selection.EntireColumn.Insert
Range("D1429").Select
Selection.Cut
Range("C14").Select
ActiveSheet.Paste
Range("C14").Select
Selection.Copy
Range("D14").Select
ActiveSheet.Paste
Range("C28").Select
Application.CutCopyMode = False
Selection.Copy
Range("D28").Select
ActiveSheet.Paste
Range("C29").Select
Application.CutCopyMode = False
Selection.Copy
Range("D29").Select
ActiveSheet.Paste
Sheets("Chart1").Select
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).Points(1).Select
Application.CutCopyMode = False
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
ActiveChart.SeriesCollection(1).Points(15).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 45
.Pattern = xlSolid
End With
ActiveChart.SeriesCollection(1).Points(16).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Sheets("Chart1").Copy
Windows("Spend per budget Centre - Charts.xls").Activate
Sheets("Data").Select
Range("D14").Select
Selection.ClearContents
Range("C15").Select
Selection.Copy
Range("D15").Select
ActiveSheet.Paste
Sheets("Chart1").Select
ActiveChart.SeriesCollection(1).Points(1).Select
ActiveChart.SeriesCollection(1).Points(2).Select
ActiveChart.Axes(xlCategory).Select
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).Points(1).Select
Application.CutCopyMode = False
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 17
.Pattern = xlSolid
End With
ActiveChart.SeriesCollection(1).Points(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Sheets("Chart1").Copy
Windows("Spend per budget Centre - Charts.xls").Activate
Sheets("Data").Select
End Sub

If anyone could help me that would be fantastic
--
Thank you
Annie
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate replication of Charts =?Utf-8?B?cmFlbF9sdWNpZA==?= Microsoft Excel Programming 6 30th Oct 2006 04:04 AM
Automate dynamic Charts from Macro Web Query Sunil_Modi Microsoft Excel Charting 0 16th Nov 2004 04:06 PM
Create multiple charts from one set of data (i.e. automate a repeating process) AlisonB Microsoft Excel Charting 5 5th Jul 2004 08:33 PM
automate generation of many charts Neil Microsoft Excel Charting 2 9th Feb 2004 07:38 PM
Using a Macro to automate Charts Llednar Microsoft Excel Charting 1 21st Sep 2003 01:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:55 AM.