#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Loops

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??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Loops

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


--
Regards
Frank Kabel
Frankfurt, Germany


Snow wrote:
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??


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Loops

Thanks Frank. I will try these and see if I can get
either to work.

Snow

-----Original Message-----
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


--
Regards
Frank Kabel
Frankfurt, Germany


Snow wrote:
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??


.

Reply
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
Using For - Next Loops in VB Biomed New Users to Excel 4 March 22nd 05 07:12 PM
Loops etc. Jonathan Vickers Excel Programming 6 February 28th 04 05:35 PM
help with loops Rick B[_6_] Excel Programming 8 January 28th 04 12:32 AM
LOOPS Fernando Duran Excel Programming 2 September 3rd 03 01:07 AM
Loops Tom Ogilvy Excel Programming 0 July 18th 03 05:20 PM


All times are GMT +1. The time now is 06:52 AM.

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

About Us

"It's about Microsoft Excel"