Hi.
I am trying to perform a vlookup between two sheets which are likely to have varying names (relating to the month in which the report is run). In attempting to do this I keep on getting errors and I was wondering if there is a simple solution to my problem.
My code so far is:
Sub MON()
Dim DT As Date
Dim WKBOOKSTAB1 As Workbook
Dim ACCPRIME As Workbook
'INPUT BOX TAKES DATE FROM USER
DT = Application.InputBox("Enter a Date as MMM YYYY")
DT = Format(DT, "MMM YYYY")
'SPECIFYING PATH WHERE INFORMATION IS TO BE POPULATED
PATH = "R: \Test\"
'SPECIFYING PATH WHERE INFORMATION IS OUTPUT TO SAS
SPATH = "R:\Output\”
Set WKBOOKSTAB1 = Workbooks.Open(SPATH & " STAB _PRIME_" & Left(Format(DT, "MMM YYYY"), 3) & "_" & Right(Format(DT, "MMM YYYY"), 4) & ".XLS")
Set ACCPRIME = Workbooks.Open(PATH & "Acc Prime.XLS")
'Windows( _
'"Acc Prime LT1.xls"). _
'Activate
'Sheets("LT1 Score Stability Indices").Select
'Range("G7").Select
'ANSWER = Application.VLOOKUP(LOOKUPVAL, WKBOOKSTAB2, 3, False)
' ActiveCell.Formula = "=VLOOKUP("(RANGE("A7"),& WKBOOKSTAB2, 3, FALSE"
'
' "=VLOOKUP("(RANGE("A7"),WKBOOKSTAB2!WKBOOKSTAB2,"3,0))"
' Range("G7").Select
'Selection.AutoFill Destination:=Range("G7:G16"), Type:=xlFillDefault
'Range("G7:G16").Select
'Range("C17").Select
'ActiveCell.FormulaR1C1 = "=SUM(R[-10]C:R[-1]C)"
'Range("C7").Select
'ActiveCell.FormulaR1C1 = "=RC[4]/100"
'Range("C7").Select
'Selection.AutoFill Destination:=Range("C7:C16"), Type:=xlFillDefault
'Range("C7:C16").Select
Any help on this would be greatly appreciated.
Please let me know if you require additional information on what I am trying to do.
Thank you in advance.
Hi.
I am trying to perform a vlookup between two sheets which are likely to have varying names (relating to the month in which the report is run). In attempting to do this I keep on getting errors and I was wondering if there is a simple solution to my problem.
My code so far is:
Sub MON()
Dim DT As Date
Dim WKBOOKSTAB1 As Workbook
Dim ACCPRIME As Workbook
'INPUT BOX TAKES DATE FROM USER
DT = Application.InputBox("Enter a Date as MMM YYYY")
DT = Format(DT, "MMM YYYY")
'SPECIFYING PATH WHERE INFORMATION IS TO BE POPULATED
PATH = "R: \Test\"
'SPECIFYING PATH WHERE INFORMATION IS OUTPUT TO SAS
SPATH = "R:\Output\”
Set WKBOOKSTAB1 = Workbooks.Open(SPATH & " STAB _PRIME_" & Left(Format(DT, "MMM YYYY"), 3) & "_" & Right(Format(DT, "MMM YYYY"), 4) & ".XLS")
Set ACCPRIME = Workbooks.Open(PATH & "Acc Prime.XLS")
'Windows( _
'"Acc Prime LT1.xls"). _
'Activate
'Sheets("LT1 Score Stability Indices").Select
'Range("G7").Select
'ANSWER = Application.VLOOKUP(LOOKUPVAL, WKBOOKSTAB2, 3, False)
' ActiveCell.Formula = "=VLOOKUP("(RANGE("A7"),& WKBOOKSTAB2, 3, FALSE"
'
' "=VLOOKUP("(RANGE("A7"),WKBOOKSTAB2!WKBOOKSTAB2,"3,0))"
' Range("G7").Select
'Selection.AutoFill Destination:=Range("G7:G16"), Type:=xlFillDefault
'Range("G7:G16").Select
'Range("C17").Select
'ActiveCell.FormulaR1C1 = "=SUM(R[-10]C:R[-1]C)"
'Range("C7").Select
'ActiveCell.FormulaR1C1 = "=RC[4]/100"
'Range("C7").Select
'Selection.AutoFill Destination:=Range("C7:C16"), Type:=xlFillDefault
'Range("C7:C16").Select
End Sub
Any help on this would be greatly appreciated.
Please let me know if you require additional information on what I am trying to do.
Thank you in advance.
I am trying to perform a vlookup between two sheets which are likely to have varying names (relating to the month in which the report is run). In attempting to do this I keep on getting errors and I was wondering if there is a simple solution to my problem.
My code so far is:
Sub MON()
Dim DT As Date
Dim WKBOOKSTAB1 As Workbook
Dim ACCPRIME As Workbook
'INPUT BOX TAKES DATE FROM USER
DT = Application.InputBox("Enter a Date as MMM YYYY")
DT = Format(DT, "MMM YYYY")
'SPECIFYING PATH WHERE INFORMATION IS TO BE POPULATED
PATH = "R: \Test\"
'SPECIFYING PATH WHERE INFORMATION IS OUTPUT TO SAS
SPATH = "R:\Output\”
Set WKBOOKSTAB1 = Workbooks.Open(SPATH & " STAB _PRIME_" & Left(Format(DT, "MMM YYYY"), 3) & "_" & Right(Format(DT, "MMM YYYY"), 4) & ".XLS")
Set ACCPRIME = Workbooks.Open(PATH & "Acc Prime.XLS")
'Windows( _
'"Acc Prime LT1.xls"). _
'Activate
'Sheets("LT1 Score Stability Indices").Select
'Range("G7").Select
'ANSWER = Application.VLOOKUP(LOOKUPVAL, WKBOOKSTAB2, 3, False)
' ActiveCell.Formula = "=VLOOKUP("(RANGE("A7"),& WKBOOKSTAB2, 3, FALSE"
'
' "=VLOOKUP("(RANGE("A7"),WKBOOKSTAB2!WKBOOKSTAB2,"3,0))"
' Range("G7").Select
'Selection.AutoFill Destination:=Range("G7:G16"), Type:=xlFillDefault
'Range("G7:G16").Select
'Range("C17").Select
'ActiveCell.FormulaR1C1 = "=SUM(R[-10]C:R[-1]C)"
'Range("C7").Select
'ActiveCell.FormulaR1C1 = "=RC[4]/100"
'Range("C7").Select
'Selection.AutoFill Destination:=Range("C7:C16"), Type:=xlFillDefault
'Range("C7:C16").Select
Any help on this would be greatly appreciated.
Please let me know if you require additional information on what I am trying to do.
Thank you in advance.
Hi.
I am trying to perform a vlookup between two sheets which are likely to have varying names (relating to the month in which the report is run). In attempting to do this I keep on getting errors and I was wondering if there is a simple solution to my problem.
My code so far is:
Sub MON()
Dim DT As Date
Dim WKBOOKSTAB1 As Workbook
Dim ACCPRIME As Workbook
'INPUT BOX TAKES DATE FROM USER
DT = Application.InputBox("Enter a Date as MMM YYYY")
DT = Format(DT, "MMM YYYY")
'SPECIFYING PATH WHERE INFORMATION IS TO BE POPULATED
PATH = "R: \Test\"
'SPECIFYING PATH WHERE INFORMATION IS OUTPUT TO SAS
SPATH = "R:\Output\”
Set WKBOOKSTAB1 = Workbooks.Open(SPATH & " STAB _PRIME_" & Left(Format(DT, "MMM YYYY"), 3) & "_" & Right(Format(DT, "MMM YYYY"), 4) & ".XLS")
Set ACCPRIME = Workbooks.Open(PATH & "Acc Prime.XLS")
'Windows( _
'"Acc Prime LT1.xls"). _
'Activate
'Sheets("LT1 Score Stability Indices").Select
'Range("G7").Select
'ANSWER = Application.VLOOKUP(LOOKUPVAL, WKBOOKSTAB2, 3, False)
' ActiveCell.Formula = "=VLOOKUP("(RANGE("A7"),& WKBOOKSTAB2, 3, FALSE"
'
' "=VLOOKUP("(RANGE("A7"),WKBOOKSTAB2!WKBOOKSTAB2,"3,0))"
' Range("G7").Select
'Selection.AutoFill Destination:=Range("G7:G16"), Type:=xlFillDefault
'Range("G7:G16").Select
'Range("C17").Select
'ActiveCell.FormulaR1C1 = "=SUM(R[-10]C:R[-1]C)"
'Range("C7").Select
'ActiveCell.FormulaR1C1 = "=RC[4]/100"
'Range("C7").Select
'Selection.AutoFill Destination:=Range("C7:C16"), Type:=xlFillDefault
'Range("C7:C16").Select
End Sub
Any help on this would be greatly appreciated.
Please let me know if you require additional information on what I am trying to do.
Thank you in advance.