Consulting

Results 1 to 4 of 4

Thread: Solved: loop Error

  1. #1

    Solved: loop Error

    [vba] 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,FALS E))"
    .Font.ColorIndex = 0
    .Font.Name = calibri
    .Font.Size = 8
    .NumberFormat = "0"
    .Value = .Value
    End With

    I = I + 1
    Next I[/vba]


    Im trying to create a loop in the vlookup

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    What are you trying to do?
    What formulas do you want in what cells?

  3. #3
    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

    [VBA] .FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC12,FTDTL1,I,FALSE)),0,VLOOKUP(RC12,FTDTL1,I,FALS E))"
    [/VBA]

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

  4. #4
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    start with this, what you want is a little confusing but i think this might help
    [VBA].FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC12,FTDTL1," & I & ",FALSE)),0,VLOOKUP(RC12,FTDTL1," & I & ",FALSE))"[/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •