Syntax error VLOOKUP

JARichard74

Board Regular
Joined
Dec 16, 2019
Messages
114
Office Version
  1. 365
Platform
  1. 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
 
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,214,909
Messages
6,122,189
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top