Loops

  • Thread starter Thread starter Snow
  • Start date Start date
S

Snow

I am attempting to run a loop which takes cell A1 and
tries to locate matching cell (e.g. B35) then replacing
D1 with C35. Any thoughts on how to write this in a
macro in Visual Basic??
 
Hi
why not use a worksheet function. e.g. the following in D1
=VLOOKUP(A1,$B$1:$C$100,2,0)

you can use this also in VBA. Try

dim ret_value
ret_value =
application.worksheetfunction.vlookup(Range("A1").value,Range("$B$1:$C$
100"),2,0)
Range("D1").value=ret_value
 
Thanks Frank. I will try these and see if I can get
either to work.

Snow
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top