LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Increment a row based on another column with duplicates possible

Sub uniqueIndex()
Dim wb As Workbook
Dim ws1 As Worksheet, ws2 As Worksheet

Set wb = ActiveWorkbook
Set ws1 = ActiveSheet
Set ws2 = wb.Sheets.Add

ws1.Range("J:J").AdvancedFilter ACtion:=xlFilterCopy,
CopyToRange:=ws2.Range("A1"), unique:=True
ws2.Range("B1").Value = "1"
ws2.Range("B1").AutoFill ws2.Range("B1",
ws2.Range("A65536").End(xlUp).Offset(0, 1)), xlFillSeries

ws1.Range("A1").Formula = "=vlookup(J1,'" & ws2.Name & "'!A:B,
2,false)"
ws1.Range("A1", ws1.Range("J65536").End(xlUp).Offset(0,
-9)).FillDown
ws1.Range("A:A").Copy
ws1.Range("A1").PasteSpecial xlPasteValues

Application.DisplayAlerts = False
ws2.Delete
Application.DisplayAlerts = True
Set ws2 = Nothing
Set ws1 = Nothing
Set wb = Nothing
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter duplicates based on criteria / column values phillr Excel Discussion (Misc queries) 0 April 9th 10 09:13 PM
finding duplicates and deleting based on another column tpeter Excel Programming 5 October 25th 09 01:16 AM
Remove Duplicates Based on more than one column Michelle Excel Programming 2 July 14th 07 01:45 AM
Coloring duplicates based on values in a column. Josh Excel Programming 6 June 4th 07 07:37 PM
increment a column based on information in another column dhemlinger New Users to Excel 2 May 25th 05 09:47 PM


All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"