Pregunta

I want to apply the following formula to the D, F, H, .... all the way down about 500 columns, every other column.

Sub Repeat()
    Range("F3").Select
    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],'ASLs total'!C[-5]:C[-4],2,0)"
    Range("F3").Select
    Selection.AutoFill Destination:=Range("F3:F1159")
    Range("F3:F1159").Select
End Sub

Any idea on how to do this?

¿Fue útil?

Solución

You could accomplish this via a for loop using the step function. Something like this:

Sub Repeat()
    For ColNum = 4 To 500 Step 2
        Range(Cells(3, ColNum), Cells(1159, ColNum)).FormulaR1C1 = "=VLOOKUP(RC[-1],'ASLs total'!C[-5]:C[-4],2,0)"
    Next ColNum
End Sub

Hope this helps

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top