Forum Discussion
Postimm
Oct 25, 2022Copper Contributor
Autofill data from a formula in a dynamic table
Hi! I believe there are similar topics like mine but as I am not that good with VBA, it is hard to adjust someone’s solution to my needs. I have 2 different tables - the first one has id colum...
HansVogelaar
Oct 25, 2022MVP
Is your second table really a table, in the sense that it has been created by clicking Table on the Insert tab of the ribbon, or Format as Table on the Home tab of the ribbon?
If so, the VLOOKUP formula should automatically be propagated to new rows.
As for VBA: you could use code like this. You'll have to modify the name of the sheet.
Dim LastRow As Long
With Worksheets("Second Sheet")
LastRow = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("E2:E" & LastRow).Formula = "=VLOOKUP(A2,...)"
End With
- PostimmOct 25, 2022Copper Contributor
HansVogelaar sorry, it is not a table, I meant that both are excel files with columns/rows 🙂 thank you a lot, I will try your solution!