Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Iinsert value into column L ...

0 views
Skip to first unread message

sal21

unread,
Sep 7, 2005, 10:29:03 AM9/7/05
to

If is possible with a mcro...

my problem, i have this sheet with many value into column A (all value
are already oredered) is possible to insert into column L the count
numebr of value repeated from a equal range block?
Example:
into line 3 and 4 is present the same value 4500450961 well inert into
column L the numer 2 into L3, blank the other line refered line 4

into line 11, 12 and 13 is present the same value 4500451080 well inert
into column L the numer 3 into L11, blank the other line refered line 12
and 13

if the value into acolumn A is present only one insert into column L
the value "0"

Tks.


+-------------------------------------------------------------------+
|Filename: ADD_NUMBER.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3786 |
+-------------------------------------------------------------------+

--
sal21


------------------------------------------------------------------------
sal21's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2040
View this thread: http://www.excelforum.com/showthread.php?threadid=465484

Rowan

unread,
Sep 7, 2005, 9:39:23 PM9/7/05
to
This is a bit ugly and assumes your data starts in row 2 i.e headings in
first row:

Sub huh()
Dim eRow As Long
Dim ColA As Range
Dim cell As Range
Dim cNtr As Long
Dim cRow As Long
Dim val As Variant '<change to suit data in column A

eRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Set ColA = Range(Cells(3, 1), Cells(eRow, 1))
val = Cells(2, 1).Value
cRow = 2
cNtr = 1
For Each cell In ColA
If cell.Value = val Then
cNtr = cNtr + 1
Else
If cNtr = 1 Then
Cells(cRow, 12).Value = 0
Else
Cells(cRow, 12).Value = cNtr
End If
cRow = cell.Row
cNtr = 1
val = cell.Value
End If
Next cell
End Sub

Hope this helps
Rowan

sal21

unread,
Sep 8, 2005, 2:42:01 AM9/8/05
to

Work fine!

0 new messages