I am very new to VBA and have to use it to build a form which has an option to pre-populate with your previous submission, the idea being that someone could submit the form (an assessment) every three months and review their progress over time, and by pre-populating with previous submission they don't have to start from scratch each time.
For this to work, I believe I would need to use a vlookup to look through the submission dates and return the values that correspond with the most recent (or max) date.
I have written this so far, but I receive the error: Run-time error '1004': Method 'VLookup' of object 'WorksheetFunction' failed.
Sub vlookup1()
Set myrange = Range("data_table")
Name = Application.WorksheetFunction.Max(Range("date_range"))
answer.Value = Application.WorksheetFunction.vlookup(Name, myrange, 4, False)
I would really appreciate some help identifying what I am doing wrong or if it's not possible to do this or there might be a better way to do it. Thank you in advance!