logandiana
Board Regular
- Joined
- Feb 21, 2017
- Messages
- 107
I built a macro that copies portions of pivot tables and charts and then pastes these onto a tab as pictures one below the other. At the end of the macro the worksheet with all the pictures is copied to the clipboard and then is easily pasted into the body of an email to be sent out. The recipients of the email only need to see the final numbers in the pivots, they don't need to be able to manipulate the pivots themselves.
The macro works every time for me, but only sometimes works when my coworker runs the macro.
Here's the portion of the code in question.
When I run the macro, the complete selection is made and then pasted correctly.
Here's an example of what it would look like with just one of the pivot tables.
Here's what hers does when the macro is run on her computer.
We stepped through and it's copying the correct parts completely, but then it pastes a cropped in version of the selection on the email tab. On each of the 5 pivots in the procedure it does the same thing.
Again, this works 100% on my computer, but hers it is random whether it works or not.
Some setting we are not aware of?
The macro works every time for me, but only sometimes works when my coworker runs the macro.
Here's the portion of the code in question.
Code:
morn.Select
morn.Columns("A:A").EntireColumn.AutoFit
morn.Range("A5:D" & Cells(24, 1).End(xlUp).Row).Copy
With eml
.Select
.Range("B3").Select
ActiveSheet.Pictures.Paste.Select
End With
morn.Select
morn.Range("F28:J" & Cells(37, 6).End(xlUp).Row).Copy
With eml
.Select
.Range("B22").Select
ActiveSheet.Pictures.Paste.Select
End With
week.Select
week.Range("H2:Q" & Cells(40, 8).End(xlUp).Row).Copy
With eml
.Select
.Range("B31").Select
ActiveSheet.Pictures.Paste.Select
End With
When I run the macro, the complete selection is made and then pasted correctly.
Here's an example of what it would look like with just one of the pivot tables.
Here's what hers does when the macro is run on her computer.
We stepped through and it's copying the correct parts completely, but then it pastes a cropped in version of the selection on the email tab. On each of the 5 pivots in the procedure it does the same thing.
Again, this works 100% on my computer, but hers it is random whether it works or not.
Some setting we are not aware of?