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?
Thank you !
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 !