Hi all
I might be getting a bit out of my league here but here goes:
I have a workbook which I drop my raw sales data into every month. It reformats the data, and converts it into a pivot table, then pivots the data around 3 different ways and produces 3 static charts (i.e. not pivot charts) from the data.
This is where I am getting a bit lazy. The charts it produces are just dumped on the worksheet any old way. I am trying to get them to line up in a specific way. So I have botched together this code which highlights the range I would like the chart to cover:
I now have highlighted an area of the workbook where I would like to place my first chart. I have also taken a peice of code from John Peltiers site:
which defines a range to place a chart in. What I would like to do (and I don't know if this is possible or not), is to merge the two, so that the range in John Peltiers code is defined by my first peice of code.
I hope it's clear what I am trying to do! Firstly - is this possible? If so can anyone help me out a bit?
Many thanks
Rich
[/code]
I might be getting a bit out of my league here but here goes:
I have a workbook which I drop my raw sales data into every month. It reformats the data, and converts it into a pivot table, then pivots the data around 3 different ways and produces 3 static charts (i.e. not pivot charts) from the data.
This is where I am getting a bit lazy. The charts it produces are just dumped on the worksheet any old way. I am trying to get them to line up in a specific way. So I have botched together this code which highlights the range I would like the chart to cover:
Code:
Sub FindRange()
Range("A1").Select
Cells.Find(What:="area", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
Range(Selection, Selection.End(xlToRight)(1, 5)).Select
Range(Selection, Selection.End(xlDown)(1)).Select
Selection.Offset(0, 5).Select
End Sub
I now have highlighted an area of the workbook where I would like to place my first chart. I have also taken a peice of code from John Peltiers site:
Code:
Sub CoverRangeWithAChart()
Dim RngToCover As Range
Dim ChtOb As ChartObject
Set RngToCover = ActiveSheet.Range("D5:J19")
Set ChtOb = ActiveChart.Parent
ChtOb.Height = RngToCover.Height ' resize
ChtOb.Width = RngToCover.Width ' resize
ChtOb.Top = RngToCover.Top ' reposition
ChtOb.Left = RngToCover.Left ' reposition
End Sub
which defines a range to place a chart in. What I would like to do (and I don't know if this is possible or not), is to merge the two, so that the range in John Peltiers code is defined by my first peice of code.
I hope it's clear what I am trying to do! Firstly - is this possible? If so can anyone help me out a bit?
Many thanks
Rich
[/code]