I agree a query would be easier, however, the users of the database want it to be in a VBA code format so the query does not have to run everytime but instead can be pulled from a table to save time.
With that being said, is there a way to make this code work or is a query the only route to go?