help needed

I have this code:

dim PNexist
PNexist=xlapp.VLookup(xlWksLDSSConnector.Range("D" & rowIndex).value, xlWksxlWbkPNlist.Range("A2:A60000"), 1, False)
lastrow = xlWksLDSSConnector.range("B63000").end(xlUp).row
for rowIndex=4 to lastrow
if Range("D" & rowIndex)<>"" then
if PNexist="#N/A" then
xlWksLDSSFulfillment.Range("A" & rowIndex).Value = "ALU"
xlWksLDSSFulfillment.Range("D" & rowIndex)=xlapp.VLookup(xlWksLDSSFulfillment.Range("B" & rowIndex).value, xlWksMasterWO.Range("F4:N60000"), 3, False)
xlWksLDSSFulfillment.Range("G" & rowIndex)=xlapp.VLookup(xlWksLDSSFulfillment.Range("B" & rowIndex).value, xlWksMasterWO.Range("F4:N60000"), 8, False)
xlWksLDSSFulfillment.Range("J" & rowIndex)=xlapp.VLookup(xlWksLDSSFulfillment.Range("B" & rowIndex).value, xlWksMasterWO.Range("F4:N60000"), 6, False)
xlWksLDSSFulfillment.Range("K" & rowIndex)=xlapp.VLookup(xlWksLDSSFulfillment.Range("B" & rowIndex).value, xlWksMasterWO.Range("F4:N60000"), 4, False)
xlWksLDSSFulfillment.Range("L" & rowIndex)=xlapp.VLookup(xlWksLDSSFulfillment.Range("B" & rowIndex).value, xlWksMasterWO.Range("F4:N60000"), 5, False)
end if
end if
next

and I get the error in the image.

what am I doing wrong?

I want both if conditions to be valid before it applies the "then"

thanks for your support

error
Nick's picture

what are you actually trying

what are you actually trying to do ?
... the code is complaining that a range does not exist..