Each month I need to copy a report that uses the same workbook each month, but with a different worksheet each month (i.e., 1-16 to 2-15-17; 2-16 to 3-15-17; etc.). On the workbook where I want to paste the data, I've added a field with an LOV to select the correct worksheet name each month. But I don't know how to write the code to find that value. Here's what I have so far:
Dim MyPath2 As String
Dim MyFile2 As String
Dim LatestFile2 As String
Dim LatestDate2 As Date
Dim LMD2 As Date
Dim Workbook_Name As String
Dim Worksheet_Name As String
Workbook_Name = ThisWorkbook.Name
(in between, I've defined the values for the variables)
Workbooks.Open MyPath2 & LatestFile2
Sheets(" ").Select - this is where I'm stuck
Range("A2:H" & Range("C" & Rows.Count).End(xlUp).Row).Copy
Windows(Workbook_Name).Activate
Sheets("Pass Plus").Range("D8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Dim MyPath2 As String
Dim MyFile2 As String
Dim LatestFile2 As String
Dim LatestDate2 As Date
Dim LMD2 As Date
Dim Workbook_Name As String
Dim Worksheet_Name As String
Workbook_Name = ThisWorkbook.Name
(in between, I've defined the values for the variables)
Workbooks.Open MyPath2 & LatestFile2
Sheets(" ").Select - this is where I'm stuck
Range("A2:H" & Range("C" & Rows.Count).End(xlUp).Row).Copy
Windows(Workbook_Name).Activate
Sheets("Pass Plus").Range("D8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False