The below Macro opens an external workbook, unhides a particular sheet and reads a couple of text values into variables, creates a new sheet in the current workbook based on those variable values, copies the contents of a worksheet in that workbook, then pastes it into the new one.
However, when I use .Paste it works fine, but doesn't retain the formatting and only pastes in the text.
If I try to correct this and use
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
It fails.
Why is this?
Sub addsheet()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
filename = Sheets("Instructions").Range("C13").Value
report = "report.xlsx"
report_filepath = "\\xxx\xxx\xxx\report.xlsx"
Dim report_name As String
Workbooks.Open Filename:=(report_filepath)
    Windows(report).Activate
    Sheets("Info").Visible = True
    Sheets("Info").Activate
    report_month = Range("B5").Text
    report_year = Range("B4").Text
    Sheets("Report").Range("A1:AJ498").Copy
    Windows(filename).Activate
    Windows(report).Close
    Set newsheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
    report_name = (report_month & " " & report_year)
    newsheet.Name = (report_name)
    Sheets("Instructions").Range("C15").Value = (report_name)
    Sheets(report_name).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
    Sheets("Instructions").Activate
End Sub
 
     
     
     
    