MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

VBA variable range in a formula

  Asked By: HCW    Date: Jan 27    Category: MS Office    Views: 2379

Hi all,

I would like to ask how can I make the range in a formula in the VBA code becomes a variable, but not hard code it?

My original code:
Range(Cells(2, 44), Cells(bill_lastrow, 44)).Formula = "=VLOOKUP(AQ2,sheet2!$N$1:$O$1144,2,FALSE)"

I would like to make "sheet2!$N$1:$O$1144" as variable, so when the last row of sheet2 not equal to 1144, let say, last row = 2224, it can still work without hard coding it.

Thanks a lot!!



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on VBA variable range in a formula Or get search suggestion and latest updates.