J
Josh Johansen
This is the code I have written for a button to copy the active pivot table
and 7 cells above and then email. What I would like to be able to do is
instead of the email automatically going to [email protected], I would like there
to be an open email message where the user can select the subject and users
they would like to email it to. Also I am having a hard time figuring out
how to maintain the formatting in the copied and pasted sheet, it leaves me
with some cells full of #####. Any help would be awesome, thanks so much!
Private Sub CommandButton1_Click()
Dim rng As Range
Set rng = ActiveSheet.PivotTables(1).TableRange2
Set rng = Range(rng(1).Offset(-7, 0), rng)
Workbooks.Add Template:=xlWBATWorksheet
ActiveSheet.Range("A1").Select
rng.Copy
ActiveSheet.Range("A1").PasteSpecial xlValues
ActiveSheet.Range("A1").PasteSpecial xlFormats
ActiveWorkbook.SendMail Subject:="Scheduling", Recipients:="[email protected]"
ActiveWorkbook.Close SaveChanges:=False
End Sub
and 7 cells above and then email. What I would like to be able to do is
instead of the email automatically going to [email protected], I would like there
to be an open email message where the user can select the subject and users
they would like to email it to. Also I am having a hard time figuring out
how to maintain the formatting in the copied and pasted sheet, it leaves me
with some cells full of #####. Any help would be awesome, thanks so much!
Private Sub CommandButton1_Click()
Dim rng As Range
Set rng = ActiveSheet.PivotTables(1).TableRange2
Set rng = Range(rng(1).Offset(-7, 0), rng)
Workbooks.Add Template:=xlWBATWorksheet
ActiveSheet.Range("A1").Select
rng.Copy
ActiveSheet.Range("A1").PasteSpecial xlValues
ActiveSheet.Range("A1").PasteSpecial xlFormats
ActiveWorkbook.SendMail Subject:="Scheduling", Recipients:="[email protected]"
ActiveWorkbook.Close SaveChanges:=False
End Sub