I need help writing the VBA for a macro that will pull the largest values from a data set in one worksheet, place them in another worksheet, and also apply the date corresponds to the large value. The end use is for insurance loss runs. Here is how I have my two sheets set up:
Sheet1 has 2 arrays(YEAR1 & YEAR2). In the first column of each array I have the date a loss occured. In the second column, the dollar amount of the loss (which I designated Loss1 & Loss2).
Sheet 2 has a cell for a loss limit that can be amended as necessary. The table in sheet2 should pull the 3 largest losses from the 2 arrays in sheet1, with the largest at the top. If the user enters a new loss limit, I would like the macro, once run again, to update the large loss based on this limit. In addition, I would like the macro to pull the corresponding dates from these large losses from the arrays in sheet1.
This is an oversimplification of my final product, but I would appreciate the help. I have attached excel workbook, and below I have listed the VBA that I have that seems work well in pulling just the largest losses:
Bookmarks