Hello,
I have a monthly file that we have. I have code that asks the user to open the prior month's file, but I'm not sure what to do after the file is open. The file name will change every month (name of month is in the file name) and each month there is a YTD, MTD and QTD. But essentially, I need to copy over a tab called "Cover" and just the first the rows from the prior month file to the current month.
Here is the code I have to open the file for the users:
So I know that:
will sort of do it, but how do I make it dynamic no matter what the file name is for the prior month?
Thank you!!
I have a monthly file that we have. I have code that asks the user to open the prior month's file, but I'm not sure what to do after the file is open. The file name will change every month (name of month is in the file name) and each month there is a YTD, MTD and QTD. But essentially, I need to copy over a tab called "Cover" and just the first the rows from the prior month file to the current month.
Here is the code I have to open the file for the users:
Code:
Sub test_fileopen()Dim filename
MsgBox "Please open prior month FRP File"
filename = Application.GetOpenFilename
If filename <> False Then
Workbooks.Open (filename)
MsgBox "Continue"
End If
End Sub
So I know that:
Code:
Rows("1:3").Select Selection.Copy
Windows("FRP Test.xlsm").Activate
Rows("1:1").Select
ActiveSheet.Paste
Thank you!!