• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 48
  • Last Modified:

Move all charts

I am using the below code to move all the charts from one sheet to a new sheet called Summary.  The problem I am having it is pasting the charts starting at H36 and I would like it to be A1.  

Sub MoveAllCharts()
   Dim ChartObj As Object
   Application.Run "Add_Sheet"
   ActiveSheet.Next.Select
   For Each ChartObj In ActiveSheet.ChartObjects
      ChartObj.Chart.Location xlLocationAsObject, "Summary"
   Next ChartObj
End Sub
Sub Add_Sheet()
    Sheets.Add Before:=ActiveSheet
    ActiveSheet.Name = "Summary"
End Sub

Open in new window

Thanks,
Montrof
0
montrof
Asked:
montrof
1 Solution
 
Saurabh Singh TeotiaCommented:
Use this code...

Sub MoveAllCharts()
   Dim ChartObj As ChartObject
   Application.Run "Add_Sheet"
   ActiveSheet.Next.Select
   For Each ChartObj In ActiveSheet.ChartObjects
      ChartObj.Chart.Location xlLocationAsObject, "Summary"
      ChartObj.Left = Sheets("Summary").Range("A1")
      ChartObj.Top = Sheets("Summary").Range("A1")
   Next ChartObj
End Sub
Sub Add_Sheet()
    Sheets.Add Before:=ActiveSheet
    ActiveSheet.Name = "Summary"
End Sub

Open in new window


Saurabh...
0
 
montrofAuthor Commented:
Thank you
Montrof
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now