C
crowdx42
Ok, so the last thing I want to do on this preoject is find a cell wit
a name in it and then insert a vloolup in a cell 4 columns to th
rights.
I have tried the code below but can't figure out how to move the inser
point from the found cell over to the column that I want to insert th
formula.
Thanks for all the help
Patrick
Sub Insert_VLOOKUP()
Dim Findfirst As Object, FindNext As Object, FindNext2 As Object
Set Findfirst = Cells.Find(What:="CARDS", LookIn:=xlValues)
If Not Findfirst Is Nothing Then
Findfirst.Select
With Range("A" & Findfirst.Row & ":F"
Findfirst.Row).Borders(xlEdgeTop)
ActiveCell.FormulaR1C1 =_
"=VLOOKUP(RC[-5],'Product pe
Call'!R[-2]C[-5]:R[484]C[10],16,FALSE)"
End With
Set FindNext2 = Findfirst
Do
Set FindNext = Cells.FindNext(After:=FindNext2)
If Not FindNext Is Nothing Then
With Range("A" & FindNext.Row & ":F"
FindNext.Row).Borders(xlEdgeTop)
ActiveCell.FormulaR4C4 =_
"=VLOOKUP(RC[-5],'Product'!R[-2]C[-5]:R[484]C[10],16,FALSE)"
End With
End If
Set FindNext2 = FindNext
FindNext2.Interior.ColorIndex = 0
FindNext2.Select
Loop Until FindNext.Address = Findfirst.Address
End With
End Su
a name in it and then insert a vloolup in a cell 4 columns to th
rights.
I have tried the code below but can't figure out how to move the inser
point from the found cell over to the column that I want to insert th
formula.
Thanks for all the help
Patrick
Sub Insert_VLOOKUP()
Dim Findfirst As Object, FindNext As Object, FindNext2 As Object
Set Findfirst = Cells.Find(What:="CARDS", LookIn:=xlValues)
If Not Findfirst Is Nothing Then
Findfirst.Select
With Range("A" & Findfirst.Row & ":F"
Findfirst.Row).Borders(xlEdgeTop)
ActiveCell.FormulaR1C1 =_
"=VLOOKUP(RC[-5],'Product pe
Call'!R[-2]C[-5]:R[484]C[10],16,FALSE)"
End With
Set FindNext2 = Findfirst
Do
Set FindNext = Cells.FindNext(After:=FindNext2)
If Not FindNext Is Nothing Then
With Range("A" & FindNext.Row & ":F"
FindNext.Row).Borders(xlEdgeTop)
ActiveCell.FormulaR4C4 =_
"=VLOOKUP(RC[-5],'Product'!R[-2]C[-5]:R[484]C[10],16,FALSE)"
End With
End If
Set FindNext2 = FindNext
FindNext2.Interior.ColorIndex = 0
FindNext2.Select
Loop Until FindNext.Address = Findfirst.Address
End With
End Su