reptitive numbers problem

louie_77077
01-16-2005, 09:40 AM
Hi

Dim cl As Range

For Each cl In [Sheet2!A1:C5]
Worksheets("SHEET3").Cells(cl.Value, cl.Column) = "1"
Next cl



here is the code I'm using right now and it works fine as you can see if sheet2 looks like this:

A
1 5
2 9
3 15
4 33
5 40
then the formula will insert a "1" in sheet3 cell A5,A9,A15,A33and A40 the problem is repetitive numbers
if the A column looks like this


A
1 1
2 4
3 1

then sheet 3 column A cell A1 should have a "2" and cell A4 would get "1"
the data is always 3 different numbers or 1 number and 2 repetitive numbers or
3 repetitive( in which case a "3" would be inserted


thanks for any help

lneilson

Kluz
01-16-2005, 10:59 AM
Instead of:Worksheets("SHEET3").Cells(cl.Value, cl.Column) = "1"
'try:
Worksheets("SHEET3").Cells(cl.Value, cl.Column).Value = Worksheets("SHEET3").Cells(cl.Value, cl.Column).Value + 1

louie_77077
01-16-2005, 12:34 PM
Instead of:Worksheets("SHEET3").Cells(cl.Value, cl.Column) = "1"
'try:
Worksheets("SHEET3").Cells(cl.Value, cl.Column).Value = Worksheets("SHEET3").Cells(cl.Value, cl.Column).Value + 1
thanks for the reply still trying to get it to work

lneilson

tinyjack
01-16-2005, 12:47 PM
What happened when you tried Kluz code, as it should do what you want.

TJ

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum