PDA

View Full Version : Solved: loop Error



khalid79m
07-06-2011, 07:18 AM
For I = 11 To 18
With ThisWorkbook.Sheets("CD").Range("N22:N" & LRCD1)
'.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC12,FTDTL1,11,FALSE)),0,VLOOKUP(RC12,FTDTL1,11,FALSE))"
.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC12,FTDTL1,I,FALSE)),0,VLOOKUP(RC12,FTDTL1,I,FALSE))"
.Font.ColorIndex = 0
.Font.Name = calibri
.Font.Size = 8
.NumberFormat = "0"
.Value = .Value
End With

I = I + 1
Next I


Im trying to create a loop in the vlookup

mikerickson
07-06-2011, 10:39 AM
What are you trying to do?
What formulas do you want in what cells?

khalid79m
07-06-2011, 12:33 PM
I want it the formula (vlookup) to start on row N22 and keep filling down until it hits the last row , however the vlookup needs to shift 1 to the left each time

hence

.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC12,FTDTL1,I,FALSE)),0,VLOOKUP(RC12,FTDTL1,I,FALSE))"


In the formula above the I is 11, then then next I is 12 etc

CatDaddy
07-06-2011, 12:40 PM
start with this, what you want is a little confusing but i think this might help
.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC12,FTDTL1," & I & ",FALSE)),0,VLOOKUP(RC12,FTDTL1," & I & ",FALSE))"