Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Many Nested loops

I'm still fairly new to programming excel but I understand basic programming
concepts and logic. I have four arrays called stgOffers, stgOffdups,
stgClients1, stgClients2. Here's what I'm looking to do:

Layout of data -- in column b are clients and they're housed in the array
stgClients2 In column c are entries that may be duplicates. these entries
are housed in the array stgOffdups. In a separate worksheet I have a column
with entries that are stored in stgOffers. In yet another worksheet I have a
column with entries that are stored in stgClients1.

What to do -- I need a loop that will take the first entry of stgOffers
(call it A) and then compare each entry of stgOffdups to A. If any entry in
stgOffdups = A then I need to compare the first entry of stgClients1 (call it
B) to every entry in stgClients2. Now, whenever an entry of stgClients2 = B,
I need to perform a specific action. I can code the specific action (I
think) but I can't seen to get this massive If For Next Then off the ground.

If anyone can give me a hand I would be most appreciative. Please send me
an email at if you would like to see the code that
I have right now.

Thanks again!
Nate
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Many Nested loops

Are these VBA arrays or range names?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"naterator" wrote in message
...
I'm still fairly new to programming excel but I understand basic

programming
concepts and logic. I have four arrays called stgOffers, stgOffdups,
stgClients1, stgClients2. Here's what I'm looking to do:

Layout of data -- in column b are clients and they're housed in the array
stgClients2 In column c are entries that may be duplicates. these entries
are housed in the array stgOffdups. In a separate worksheet I have a

column
with entries that are stored in stgOffers. In yet another worksheet I have

a
column with entries that are stored in stgClients1.

What to do -- I need a loop that will take the first entry of stgOffers
(call it A) and then compare each entry of stgOffdups to A. If any entry

in
stgOffdups = A then I need to compare the first entry of stgClients1 (call

it
B) to every entry in stgClients2. Now, whenever an entry of stgClients2 =

B,
I need to perform a specific action. I can code the specific action (I
think) but I can't seen to get this massive If For Next Then off the

ground.

If anyone can give me a hand I would be most appreciative. Please send me
an email at if you would like to see the code

that
I have right now.

Thanks again!
Nate



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Many Nested loops

You use the term array, but then imply that these are actually range
references?

if these are references to ranges:

Dim cell as Range, cell2 as Range
Dim a as variant, b as variant
set cell = stgOffers(1)
A = cell.Value
if application.Countif(stgOffdups,A) 0 then
b = stgClients1(1).Value
for each cell2 in stgClients2
if cell2.Value = b then
' perform a specific action
end if
next cell2
end if


My guess is this isn't exactly what you want, but it is exactly what you
described.

--
Regards,
Tom Ogilvy

"naterator" wrote:

I'm still fairly new to programming excel but I understand basic programming
concepts and logic. I have four arrays called stgOffers, stgOffdups,
stgClients1, stgClients2. Here's what I'm looking to do:

Layout of data -- in column b are clients and they're housed in the array
stgClients2 In column c are entries that may be duplicates. these entries
are housed in the array stgOffdups. In a separate worksheet I have a column
with entries that are stored in stgOffers. In yet another worksheet I have a
column with entries that are stored in stgClients1.

What to do -- I need a loop that will take the first entry of stgOffers
(call it A) and then compare each entry of stgOffdups to A. If any entry in
stgOffdups = A then I need to compare the first entry of stgClients1 (call it
B) to every entry in stgClients2. Now, whenever an entry of stgClients2 = B,
I need to perform a specific action. I can code the specific action (I
think) but I can't seen to get this massive If For Next Then off the ground.

If anyone can give me a hand I would be most appreciative. Please send me
an email at if you would like to see the code that
I have right now.

Thanks again!
Nate

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Many Nested loops

I agree with Tom that this isn't what you wanted but it is what you
described. You chose the first value of the first column and you didn't say
that you wanted to loop through all the cells of the first column. Do you?
HTH Otto
"naterator" wrote in message
...
I'm still fairly new to programming excel but I understand basic
programming
concepts and logic. I have four arrays called stgOffers, stgOffdups,
stgClients1, stgClients2. Here's what I'm looking to do:

Layout of data -- in column b are clients and they're housed in the array
stgClients2 In column c are entries that may be duplicates. these entries
are housed in the array stgOffdups. In a separate worksheet I have a
column
with entries that are stored in stgOffers. In yet another worksheet I have
a
column with entries that are stored in stgClients1.

What to do -- I need a loop that will take the first entry of stgOffers
(call it A) and then compare each entry of stgOffdups to A. If any entry
in
stgOffdups = A then I need to compare the first entry of stgClients1 (call
it
B) to every entry in stgClients2. Now, whenever an entry of stgClients2 =
B,
I need to perform a specific action. I can code the specific action (I
think) but I can't seen to get this massive If For Next Then off the
ground.

If anyone can give me a hand I would be most appreciative. Please send me
an email at if you would like to see the code
that
I have right now.

Thanks again!
Nate



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Many Nested loops

All,

You're right. I didn't communicate my situation very well. I have a column
of campaigns. On the right of this column I have another column filled with
client names. Here's an example:
COL A COL B
jack camp1
barb camp1
jack camp2
camp2
jack camp3
joe camp3

In a different worksheet I have a column with nonduplicated campaign names.
i.e.:

Col C
camp 1
camp 2
camp 3

Now in yet another worksheet I have a column with the clients (no dups)
Col D
barb
jack
joe

Now I need get the information from the first two columns COL A and B into a
table in a new worksheet where the rows labels are the campaigns from Col C
and the column labels are from Col D. So, I need to be able to go down COLs
A & B, look at the entries, and then put a 1 in the proper location in my
table. This seems easy if I can use array indexes. Does that clear any
confusion? So yes, I do need to loop through the entries of COL A. The code
supplied so far by you guys makes sense and is helpful. I'm just not sure I
can fill the table in without indexes.

BTW, I am enrolled in a VBA class set to start this fall. So, I am RTFM = )
Until then though, thanks for all the help!!

Nate


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
Help with nested for loops [email protected] Excel Discussion (Misc queries) 5 May 2nd 07 05:30 PM
nested loops jer Excel Programming 2 January 15th 06 09:09 PM
nested for loops and end for SandyR Excel Programming 3 October 6th 05 09:36 PM
Help on nested loops Jan Lukszo Excel Programming 1 July 29th 04 08:41 AM
Nested loops?? CG Rosén Excel Programming 1 June 22nd 04 08:07 PM


All times are GMT +1. The time now is 03:21 AM.

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"