ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to replace numbers in sequence without sorting? (https://www.excelbanter.com/excel-programming/443369-how-replace-numbers-sequence-without-sorting.html)

geniusideas

How to replace numbers in sequence without sorting?
 
Hi,

I need to replace those numbers duplicate so that it follow in
sequence for example:

In Column A I have these number
2,1,5,3,3,6,8,8 (Before)
2,1,5,3,4,6,8,9 (after)
Anyone got idea how to do it with macro?
Please.Thanks

Per Jessen[_2_]

How to replace numbers in sequence without sorting?
 
See if this suit your needs:

Sub SequenseFill()
Col = "A"
FirstRow = 1
LastRow = Cells(FirstRow, Col).End(xlDown).Row
For r = FirstRow + 1 To LastRow
If Cells(r - 1, Col) = Cells(r, Col) Then
Cells(r, Col) = Cells(r, Col) + 1
End If
Next
End Sub

Regards,
Per

On 20 Jul., 15:48, geniusideas wrote:
Hi,

I need to replace those numbers duplicate so that it follow in
sequence for example:

In Column A I have these number
2,1,5,3,3,6,8,8 (Before)
2,1,5,3,4,6,8,9 (after)
Anyone got idea how to do it with macro?
Please.Thanks




All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com