(Solved) – VBA to select row(s) containing same ID in column, highlight rows, then proceed to next ID and copy ID to clipboard

(solved)-–-vba-to-select-row(s)-containing-same-id-in-column,-highlight-rows,-then-proceed-to-next-id-and-copy-id-to-clipboard

I am looking for VBA code that will select row(s) containing the same ID in column A, highlight the rows, and then proceed to next unique ID in column A and copy the ID to my clipboard. This is to automate a very redundant process I have at work.

If it helps, here is a snippet of code from another macro that inserts a space between the unique ID’s in column A:

 Dim lastRow As Long
 Dim x As Long
 lastRow = Cells(Rows.Count, 1).End(xlUp).Row
 Application.ScreenUpdating = False

 For x = lastRow To 2 Step -1
     If Cells(x, 1).Value <> Cells(x - 1, 1).Value Then
         If Cells(x, 1).Value <> "" Then
             If Cells(x - 1, 1).Value <> "" Then
                 Cells(x, 1).EntireRow.Insert Shift:=xlDown
             End If
         End If
     End If

 Next x
 Application.ScreenUpdating = True

Thanks so much for your help!

Leave a Reply

Your email address will not be published. Required fields are marked *