JARichard74
Board Regular
- Joined
- Dec 16, 2019
- Messages
- 114
- Office Version
- 365
- Platform
- Windows
Trying to put the Vlookup formulas in cells B17 and B18 in this case as x=2 so that cell B17 in the Debrief sheet has the formula =VLOOKUP($A$3,Mandatory!A4:B7,2,FALSE) and cell B18 has formula =VLOOKUP($A$3,Mandatory!A9:B12,2,FALSE). In this case j=4 . Tried the following but get a syntax error
VBA Code:
Dim i As Integer
For i = 1 to x
ThisWorkbook.Worksheets("Debrief").Range("B17:B" & i + 17).Formula = "=VLOOKUP($A$3,Mandatory!"A" & i * j + i - j + 3:"B" & i * j + i - j + 6,2,FALSE)"
Next x