Hi all,

I'm very new here (first post) and relatively new to using VBA. I am building a procedure to organize a report that I generate at work and I cannot figure out how to use variables to make my vlookup function. I'm not sure what else to say about the code other than that. I have left example code below:

Please Login or Register  to view this content.
I left comments in there so that you could see my thought process through this section of the code. Also, the variable <monthCount> is defined earlier in the code and works just fine. When I run the code it fails on the last line with a 1004 error. When I click debug on the prompt that line goes yellow, mousing over the variable returns the ranges I want them to return, but none the less the code does not work. If I set up a variable that is assigned to an input box and then assign ActiveCell.Formula to that variable and write the vlookup function manually the code will work.

Anyway, this seems like it is really simple but none of the searches I have completed have turned up a working answer. Any help is much appreciated, if you need more infor just respond back.