Issue when save to other worbook

otrava18

Board Regular
Joined
Feb 11, 2018
Messages
61
Hello,

I have a macro that copy a range from an workbook and paste it into a new one with a cell value name. If i run this macro it works until .Execute . In the end i have a new workbook with desired format and values but i receive error and i need to resolve this. Can anyone help me with this issue or give me an idea?

VBA Code:
Sub SAVE_AS_LL()
Dim saveDialog As FileDialog
Worksheets("LL").Range("A1:J178").Copy
Dim i As Integer

    Set sht = ActiveSheet
    ThisWorkbook.Worksheets("LL").Range("A1:J178").Copy
    
    Workbooks.Add

    ActiveSheet.Range("A1").PasteSpecial Paste:=xlPasteValues
    ActiveSheet.Range("A1").PasteSpecial Paste:=xlPasteColumnWidths
    ActiveSheet.Range("A1").PasteSpecial Paste:=xlPasteFormats
    Range("G7:I135").NumberFormat = "#,##0.00 €"
    Range("F137").NumberFormat = "#,##0.00 €"
    Range("F140:F145").NumberFormat = "#,##0.00 €"
    
    With Worksheets("Sheet1").Rows("167:171")
    .RowHeight = .RowHeight * 2
    End With
    Rows(168).Hidden = True
    For i = 145 To 6 Step -1
        If ActiveSheet.Cells(i, 6).Value = 0 Then ActiveSheet.Rows(i).Delete
    Next i
    Set saveDialog = Application.FileDialog(msoFileDialogSaveAs)
    With saveDialog
       .InitialFileName = ThisWorkbook.Worksheets("INFO").Range("D12").Value
       .Show
       .Execute
    End With
 
End Sub

Thank you !
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top