View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Patti[_5_] Patti[_5_] is offline
external usenet poster
 
Posts: 20
Default One more loop question

But are we talking about the first row with a valid code, or just the
first
row for the name?


Always to the first row for the name... I'm moving the data I need to the
first row for each name. In the end, duplicate rows will be deleted, so all
info needs to be on the first row for that name.

I am confused. It is the Case statement where it is found so the statement
'... Once I find a valid code, I want to quit looking, and enter what I
found (via the case statement) ...' is incompatible as I understand it.

And,
the CAse statement sets the Found flag to true whatever the value

evaluated!

I'm just not explaining myself well. Should be once I find a valid code OR
a NULL. I real life, when I find a NULL, I just want to set FoundFlag to
True so that it will END SELECT and go on to the next AgtName. In the test
loop, I am writing a comment in column P when NULL is found purely so that I
can see that it is working.

That's because the If Else makes you skip it as I showed you.

If possible, I'd really like to stick close to the code I've got. I'm

sure that there is always going to be a technically "better" method, but I
really need to learn to do this myself, & it's hard to get a handle on

when I
keep "starting over".

But you can't, it doesn't work.


That much I know ; ) I would have thought it'd be adaptable though.
I know you provided alternate code that doesn't skip a row, but as I said,
it only find a valid code OR Null ( my "FoundFlag") if appears in the same
row as the first instance of the name. This won't always be the case...





"Bob Phillips" wrote in message
...

"Patti" wrote in message
...
Bob,

I'm sure this problem is nowhere near as confusing as my explanation my

make
it seem...

For each name in column A, I need to look down a list for various codes

in
column L. Once I find a valid code, I want to quit looking, and enter

what
I found (via the case statement) in column P of the first row in which

that
name appeared.


I am confused. It is the Case statement where it is found so the statement
'... Once I find a valid code, I want to quit looking, and enter what I
found (via the case statement) ...' is incompatible as I understand it.

And,
the CAse statement sets the Found flag to true whatever the value

evaluated!

It has to be in the row with the _first_ instance of the
name because once I get this Sub to work, I am going to delete rows so

that
each name appears only once (keeping the row where the name first

appears).

But are we talking about the firts row with a valid code, or just the

first
row for the name?

Oh, I get it now... but how can I reset the Agtname _and_ have it

evaluated
in the first instance?


As I showed you in my follow-up response.

I tried to use "offset" to set it to the name on
the _next_ row, but it still skipped the first instance of a new name.


That's because the If Else makes you skip it as I showed you.

If possible, I'd really like to stick close to the code I've got. I'm

sure
that there is always going to be a technically "better" method, but I

really
need to learn to do this myself, & it's hard to get a handle on when I

keep
"starting over".


But you can't, it doesn't work.