Hi All,
I need help on the below problem. I couldn't not find exact solution in the forum.
I need to filter data in the source workbook, copy that visible data and then open new workbook and paste data in it. Also save new workbook on the given location.
I tried below code but it is useful when we need to copy whole workbook instead of copying on visible data!! I am unable to edit it.
Thank you
I need help on the below problem. I couldn't not find exact solution in the forum.
I need to filter data in the source workbook, copy that visible data and then open new workbook and paste data in it. Also save new workbook on the given location.
I tried below code but it is useful when we need to copy whole workbook instead of copying on visible data!! I am unable to edit it.
Code:
Sub India()
Dim FName As String
Dim FPath As String
Dim NewBook As Workbook
FPath = "C:\Users\aman\Desktop\Ideas\process\Master files\testing\India"
FName = "LearnersinMandateDataExport_India_" & Format(Date, "mmddyyyy") & ".xlsx"
Sheets("Sheet1").Copy 'Creates a new workbook with the copied sheet
Set NewBook = ActiveWorkbook
If Dir(FPath & "\" & "Kerala_" & FName) <> "" Then
MsgBox "File " & FPath & "\" & FName & " already exists"
Else
NewBook.SaveAs Filename:=FPath & "\" & "India_" & FName
MsgBox "File - " & FName & " saved to the defined location"
End If
ActiveWorkbook.Save
End Sub
Thank you
Last edited: