Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default using vlookup in a loop

Basically I have 2 sheets, "invoice" and "data".

I'm pulling data out of the data sheet and populating fields in the invoice.
I've been using vlookup to pull the data from the "data" sheet, populate the
invoice using the vlookup, do stuff with the invoice sheet (which i've built
a macro for already), and then I'd manually increase the target value by one
to go onto the next row.

I need a macro that will loop by adding +1 to the target value in my vlookup
formula and keep looping until there are no rows left.

Alternatively it'd be useful if a dialogue box would let the user tell the
macro where to start and end with the loop...if that's feasible.

any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default using vlookup in a loop

On Fri, 19 Sep 2008 12:11:01 -0700, chrismv48
wrote:

Basically I have 2 sheets, "invoice" and "data".

I'm pulling data out of the data sheet and populating fields in the invoice.
I've been using vlookup to pull the data from the "data" sheet, populate the
invoice using the vlookup, do stuff with the invoice sheet (which i've built
a macro for already), and then I'd manually increase the target value by one
to go onto the next row.

I need a macro that will loop by adding +1 to the target value in my vlookup
formula and keep looping until there are no rows left.

Alternatively it'd be useful if a dialogue box would let the user tell the
macro where to start and end with the loop...if that's feasible.

any suggestions?



Please give some more information to make it easier to help:

1) What does your VLOOKUP statement look like right now
2) What do you mean by "target value"
3) What do you mean by "there are no rows left"

Lars-Åke
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default using vlookup in a loop

Okay I'm trying to set a user defined range to use in VLOOKUP. So for
starters, I'd like the user to select the range, then to have that range used
in the vlookup formula that's already stored in a cell, E3.

That way the user can decide what he/she wants to use as data.

Once that vlookup range is set, to let's say A1:B10 by the user, we need to
have a loop run that will increment the target cell each time. example:

-the formula in cell E3 starts as "=VLOOKUP(C$10$,UserRange,5,False)"
-at this point i have another macro to do other things, and at completion
the loop starts over so the target cell used in VLOOKUP (C10) will need to
interate by +1 until the last row in UserRange is reached...so if currently
cell C10 reads:

=July!A10 'the loop would add to the range each time by 1. So:
=July!A11
=July!A12
=July!A13

Until it reaches the end of the Vlookup range.

Sorry if that was confusing--I realize now that the way I explained it
initially was inaccurate.

"Lars-Ã…ke Aspelin" wrote:

On Fri, 19 Sep 2008 12:11:01 -0700, chrismv48
wrote:

Basically I have 2 sheets, "invoice" and "data".

I'm pulling data out of the data sheet and populating fields in the invoice.
I've been using vlookup to pull the data from the "data" sheet, populate the
invoice using the vlookup, do stuff with the invoice sheet (which i've built
a macro for already), and then I'd manually increase the target value by one
to go onto the next row.

I need a macro that will loop by adding +1 to the target value in my vlookup
formula and keep looping until there are no rows left.

Alternatively it'd be useful if a dialogue box would let the user tell the
macro where to start and end with the loop...if that's feasible.

any suggestions?



Please give some more information to make it easier to help:

1) What does your VLOOKUP statement look like right now
2) What do you mean by "target value"
3) What do you mean by "there are no rows left"

Lars-Ã…ke

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
Vlookup and print loop MM User Excel Programming 7 August 14th 08 04:29 PM
loop and vlookup NewToVB Excel Programming 5 July 26th 07 02:44 PM
Add loop to Vlookup Les Excel Programming 1 April 19th 07 04:05 AM
Need a vb loop for vlookup [email protected] Excel Programming 3 August 25th 05 12:32 PM
Need a vb loop for vlookup [email protected] Excel Programming 2 August 24th 05 04:07 PM


All times are GMT +1. The time now is 03:59 PM.

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"