![]() |
Iinsert value into column L ...
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...fo&userid=2040 View this thread: http://www.excelforum.com/showthread...hreadid=465484 |
Iinsert value into column L ...
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 wrote: 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 | +-------------------------------------------------------------------+ |
Iinsert value into column L ...
Rowan Wrote: 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 wrote: 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 | +-------------------------------------------------------------------+ Work fine! -- sal21 ------------------------------------------------------------------------ sal21's Profile: http://www.excelforum.com/member.php...fo&userid=2040 View this thread: http://www.excelforum.com/showthread...hreadid=465484 |
All times are GMT +1. The time now is 01:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com