I am trying write code for a Vlookup based on the current date in d-mmm form. I would like the code to search through each worksheet, there will be a worksheet for each calendar month, and return the value of different categories of disbursements. I am not sure how to do this and went searching on the web for something similar, and tried to adapt it, but I think my coding for the function is not correct, so I get an error.
I would like the values for each disbursement category and return them to the TestBook2.xlsm workbook under the disbursements tab.
If anyone could help, I'd really appreciate. I have attached sample spreadsheets and the code below:
Sub Looking()
Dim Disb As Workbook
Dim Wsht As Worksheet
Dim Search As Date
Dim FindIt As Integer
What = Format(Date, "d-mmm")
For Each Wsht In ActiveWorkbook.Worksheets
With Wsht
Set Tble_Array = .Range("A2", "A35")
FindIt = WorksheetFunction.VLookup(What, Sheets(.Index).Range("A4:A29"), 6, False)
End With
If Not IsEmpty(FindIt) Then Exit For
Next Wsht
Set Tble_Array = Nothing
VLOOKAllSheets = FindIt
End Sub
Bookmarks