LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find a cell and then insert a formula into adjacent cell


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

--
crowdx4
-----------------------------------------------------------------------
crowdx42's Profile: http://www.excelforum.com/member.php...fo&userid=3774
View this thread: http://www.excelforum.com/showthread.php?threadid=57365

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find duplicate, but only if an adjacent cell is identical [email protected] Excel Worksheet Functions 2 July 30th 08 02:14 PM
find data in adjacent cell Leon Jaeggi Excel Discussion (Misc queries) 2 May 27th 06 01:36 PM
how do I insert a cell based on its match with an adjacent cell? Gabbon Excel Worksheet Functions 12 January 24th 06 12:28 PM
Auto date/time insert when data entered into an adjacent cell Auto date/time Excel Worksheet Functions 1 July 9th 05 12:10 AM
Find Cell and Copy adjacent value to another location JJalomo Excel Programming 2 March 8th 05 07:17 PM


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"