To save file and add new workbook
Sub save file and add workbook()
On Error GoTo Err:
Dim s As String
Dim path1 As String
Dim wbo As Workbook
path1 = ThisWorkbook.Sheets("Input billing").Range("b9").Value
s = ThisWorkbook.Sheets("Government").Range("c3")
Sheets("Government").Range("a1:i40").Select
wbo = Workbooks.Add
Application.DisplayAlerts = False
Sheets("Government").Range("A1:i40").Copy
ActiveWorkbook.SaveAs (path1 & s & ".xlsx")
ActiveWorkbook.Close
Application.DisplayAlerts = True
MsgBox "Done"
Exit Sub
Err:
MsgBox " Please close the excel file related to Benefits sheet"
End Sub
No comments:
Post a Comment