View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Taru[_3_] Taru[_3_] is offline
external usenet poster
 
Posts: 1
Default Find and Paste Program


OK I read a little and learned very very little about VBA.

I opened VBA and added a Module, I actually copied and pasted exactly
what you wrote into the module and ran it just like it is below.

Dim rng as Range, cell as Range, rng1 as Range
With Worksheets('Sheet1")
set rng = .Range("A1:A626")
End with
With Worksheets("Sheet2')
for each cell in rng
set rng1 = .Range("B1:Z13000").Find(cell.Value)
if not rng1 is nothing then
cell.offset(0,1).Value = .Cells(rng1.row,1)
end if
Next
end With

After running this a got an error that said Compile error;
Expected:expression.
I assumed this was because you have an apostrophy(') before sheet1
instead of a quote ("). I replaced the ' with a " and that problem went
away. I also modified the ranges so that they fit my document, i.e., I
changed set rng to .Range("F2:F262") and rng1 to .Range("B1:IV13627")

I ran it again and got this error, Compile Error; Invalid outside
procedure. And it highlights with worksheets("sheet1"). and Sheet1 is
the actual name of the sheet I'm using. I went ahead and changed the
second sheets name to its real name, VVGI.TC_EST.

However, I'm not sure If I'm clear on what I need it to do. I don't
need it to compare an entire column. I need it to find a specific cell
and report back the first cell in that row.


--
Taru
------------------------------------------------------------------------
Taru's Profile: http://www.excelforum.com/member.php...o&userid=35494
View this thread: http://www.excelforum.com/showthread...hreadid=552664