S
Sunnyskies
Morning from a overcast South Africa,
I have this macro that is supposed to copy a worksheet, paste the values and
formats onto a new worksheet and then send the new worksheet via e-mail.
Can you please identify why when copy and pasted onto the new worksheet ,the
calculated cells all have #REF!.
Here is the macro that is causing the problem.
Sub EMail()
'Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="Drivers"
Next n
Application.ScreenUpdating = True
'End Sub
Dim wb As Workbook
Application.ScreenUpdating = False
ActiveSheet.Copy
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set wb = ActiveWorkbook
With wb
..SendMail "", _
ThisWorkbook.Names("Spreadsheet_Name").RefersToRange.Value
'Range ("E2") & " Payroll MonthEnd figures"
'"This is the Subject line"
..Close False
End With
Application.ScreenUpdating = True
'End Sub
'Sub ProtectAllSheets()
Application.ScreenUpdating = False
'Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="Drivers"
Next n
Application.ScreenUpdating = True
End Sub
Waiting in anticipation.
I have this macro that is supposed to copy a worksheet, paste the values and
formats onto a new worksheet and then send the new worksheet via e-mail.
Can you please identify why when copy and pasted onto the new worksheet ,the
calculated cells all have #REF!.
Here is the macro that is causing the problem.
Sub EMail()
'Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="Drivers"
Next n
Application.ScreenUpdating = True
'End Sub
Dim wb As Workbook
Application.ScreenUpdating = False
ActiveSheet.Copy
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set wb = ActiveWorkbook
With wb
..SendMail "", _
ThisWorkbook.Names("Spreadsheet_Name").RefersToRange.Value
'Range ("E2") & " Payroll MonthEnd figures"
'"This is the Subject line"
..Close False
End With
Application.ScreenUpdating = True
'End Sub
'Sub ProtectAllSheets()
Application.ScreenUpdating = False
'Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="Drivers"
Next n
Application.ScreenUpdating = True
End Sub
Waiting in anticipation.