paste special error - might be referencing sheet problem?

Viewed 25

When my code hits the last line I show here it errors and goes to debug.

I think I am making a mistake referencing the name of my new worksheet but I am struggling with how to correct.


PDF_Name = "Ticket " & Range("c4") & " RFCO PDF"
    
     Set File_Dialog = Application.FileDialog(msoFileDialogFolderPicker)
        File_Dialog.AllowMultiSelect = False
        File_Dialog.Title = "Select the Desired Location"
        If File_Dialog.Show <> -1 Then
            MsgBox "PDF Not Created. Please click 'Copy and Export' and then choose a location for the new file. Until you do this the RFCO has not been saved."
            Exit Sub
        End If
        

    NextPageName = "Ticket " & Range("c4")
    CurSheet = ActiveSheet.Name
    Sheets.Add After:=Sheets("RFCO")
    ActiveSheet.Name = NextPageName
    ActiveWindow.DisplayGridlines = False
    
    Sheets("RFCO").Cells.Copy
    Sheets(NextPageName).Range("A1").PasteSpecial Paste:=xlPasteAllUsingSourceTheme
    
    Sheets(NextPageName).Range("b18:f41").ClearContents
    Sheets(NextPageName).Range("b44:f65").ClearContents
    Sheets(NextPageName).Range("b68:f90").ClearContents
    Sheets(NextPageName).Range("b95:f177").ClearContents
    Sheets(NextPageName).Range("b181:f244").ClearContents
    Sheets(NextPageName).Range("b248:f295").ClearContents
    Sheets(NextPageName).Range("b299:f362").ClearContents
    Sheets(NextPageName).Range("b368:f495").ClearContents
    
    Sheets("RFCO").Cells.Copy
    Sheets(NextPageName).Range("A1").PasteSpecial Paste:=xlPasteValues
0 Answers
Related