gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,341
- Office Version
- 365
- Platform
- Windows
I have this code below that is suppose to place a lookup formula down each one of the column,
When I run the code it is only placing the formula in the first row (11).
I know my last row is 51 and I know the code is determining the correct last row because I can see its selecting E11:E51
Its just not putting the formula in each row.
This code was running fine until today
Thanks for the help
When I run the code it is only placing the formula in the first row (11).
I know my last row is 51 and I know the code is determining the correct last row because I can see its selecting E11:E51
Its just not putting the formula in each row.
This code was running fine until today
Code:
Sub AutofillAssocPartData()
'Auto-populate the associated fields: Description, Rev, UM and Commodity
MsgBox "If the listed part exisit in Costpoint, this will pull in the associated Description, Rev, UM and Commodity"
Dim LRow As Long
LRow = Sheets("Part List").Cells(Rows.Count, "B").End(xlUp).Row
Sheets("Part List").Select
Range("C11:C" & LRow).Activate
ActiveCell.FormulaR1C1 = _
"=IFNA((XLOOKUP([@[Part List]],ModelGeneral_vluItem[ItemID],ModelGeneral_vluItem[ItemDescription])),"""")"
Range("D11:D" & LRow).Select
ActiveCell.FormulaR1C1 = _
"=IFNA((XLOOKUP([@[Part List]],ModelGeneral_vluItem[ItemID],ModelGeneral_vluItem[LastRevisionID])),"""")"
Range("E11:E" & LRow).Select
ActiveCell.FormulaR1C1 = _
"=IFNA((XLOOKUP([@[Part List]],ModelGeneral_vluItem[ItemID],ModelGeneral_vluItem[DefaultUnitofMeasureCode])),"""")"
Range("F11:F" & LRow).Select
ActiveCell.FormulaR1C1 = _
"=IFNA((XLOOKUP([@[Part List]],ModelGeneral_vluItem[ItemID],ModelGeneral_vluItem[Commodity])),"""")"
' Sheets("Part List").Select
' Range("C11:F" & LRow).Select
' Selection.Copy
' Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
' :=False, Transpose:=False
' Application.CutCopyMode = False
' Calculate
'Sheets("Part List").Select
' Range("B11").Select
End Sub
Thanks for the help