Hi everybody,
after some research I cannot find a way to make my macro work... I hope someone can help me...
Here is my issue:
In a macro I want to automatically insert a formula in several cells. The formula depends on other cells, and I want to be able to manipulate these cells with variables. Here is my code:
Sheets("DATOS YTD 2014").Cells(I, Semana + 1).Formula = "=VLOOKUP(" & Sheets("DATOS YTD 2014").Cells(I, 3) & "," & SheetMonth.Range("B3:W172") & ",6,0)"
All my variables are declared
Sheets("DATOS YTD 2014").Cells(I, Semana + 1) is the cell I want to be able to chose thanks to the variables I and Semana
Sheets("DATOS YTD 2014").Cells(I, 3) is the reference cell for the VLOOKUP formula, that will vary with I
SheetMonth.Range("B3:W172") is a range in the sheet SheetMonth which is fixed
The error message I receive is the following: "Run-time error 13, Type mismatch"
I precise that the next step is to make the ",6," part in the vlookup formula also variable... but I guess once my current issue is solved this one will be a piece of cake.
I would appreciate any help!
Regards
Paul
Bookmarks