You know what, I've opened a new session of excel and tried the code once
again, just to be extra sure. This time, however, it seems to work fine -
I'm not sure why it failed before, but its all ok now. Thanks for helping,
although I do have one more issue.....
I've now amended the code to tailor it to my needs. wsDest is now set as
the array of worksheets in my current (active) document, while wsSource is
set as a sheet called "Summary" in another document. (I believe you have
seen my other thread this morning, whereby I have one document, and all
sheets containing charts are copied out (inc. the values and formats, etc)
into a new document). How can I (if possible) reference another sheet in
another workbook?
I've attached the new code below:
========
Sub CopyAllPictures()
Dim r As Long, c As Long
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim pic As Picture
Set wsSource = Worksheets("Summary")
Set wsDest = Worksheets(Array("PC (Chart)-UK-MONTH", "PC (Chart)-NI-MONTH", _
"PC (Chart)-UK&NI-MONTH", "PC (Chart)-UK-YTD", "PC (Chart)-NI-YTD", _
"PC (Chart)-UK&NI-YTD", "PC (Chart)-UK-R12", "PC (Chart)-NI-R12", _
"PC (Chart)-UK&NI-R12", "HH (Chart)-UK-MONTH", "CV (Chart)-UK-MONTH"))
r = wsSource.Rows.Count
c = wsSource.Columns.Count
For Each pic In wsSource.Pictures
With pic.TopLeftCell
If .Row < r Then r = .Row
If .Column < c Then c = .Column
End With
Next
wsDest.Activate
wsDest.Cells(r, c).Activate
wsSource.Pictures.Copy
wsDest.Paste
wsDest.Cells(r, c).Activate
End Sub
========