Thread: need help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
scott scott is offline
external usenet poster
 
Posts: 577
Default need help

You could just loop over your cells and have it count the number of things
that you're looking for in each row. If you set up a loop using two
variables, let's say i and j you could have something like

for i = 1 to 10
for j = 1 to 3
'your code here
next j
next i

where it would look over the data going (in this case rows then columns).
You could then do whatever you want by using an if statement in the middle,
or just using an increment. It's hard to tell what exactly you're looking
for, but this might give you an idea of something to try. And instead of 1
to 10, you could always change it to something like 1 to
excel.worksheetfunction.counta(rows(1)) or something so that it will expand
as your data expands.

Cheers,

Scott



"austanley" wrote:


Hi,

I have, say, three columns and ten rows data, so totally thirty cells
of data. And some of the data appeared once, twice, three times or even
four times.
What I need to do is assign a unique number to each row. If the same
data appeared twice in two rows, these two rows will share the same
unique number.If the same data appeared three times, these one, two or
three rows will share the same unique number.....
I am not sure if this can be done by VBA, say, if the data size
increase in the future.
Anyone can help me or give me some hints?
Thanks a lot!


--
austanley
------------------------------------------------------------------------
austanley's Profile: http://www.excelforum.com/member.php...o&userid=35921
View this thread: http://www.excelforum.com/showthread...hreadid=569339