Move cells down

G

gary

My spreadsheet has:

G T
001504798-2 001504798-2 xoxoxox
001511777-5 001511777-5 485505
001511905-4 001511905-4 48304550
001512678-2 001512678-2 yyyyyyy
001512678-2 001512697-9 zzzzzz
001512678-2 001513196-6
001512678-2 001513504-1 dododod
001512678-2 001513842-6
001512697-9 001514491-5 $$%^&
001512697-9 001514725-7
001512697-9 001515239-8
001512697-9
001513196-6
001513504-1
001513504-1
001513504-1
001513842-6
001514491-5
001514491-5
001514491-5
001514491-5
001514491-5
001514725-7
001514725-7
001514725-7
001514725-7
001514725-7
001515239-8
001515239-8
001515239-8
001515239-8
001515239-8
001515312-0

Note: The cells in T may have more than 11 characters but I want to
match on the 11 leftmost characters.



How can I move the cells in COL T down until they are on the same row
as the matching cells in COL G so the result is:

G T
001504798-2 001504798-2 xoxoxox
001511777-5 001511777-5 485505
001511905-4 001511905-4 48304550
001512678-2 001512678-2 yyyyyyy
001512678-2
001512678-2
001512678-2
001512678-2
001512697-9 001512697-9 zzzzzz
001512697-9
001512697-9
001512697-9
001513196-6 001513196-6
001513504-1 001513504-1 dododod
001513504-1
001513504-1
001513842-6 001513842-6
001514491-5 001514491-5 $$%^&
001514491-5
001514491-5
001514491-5
001514491-5
001514725-7 001514725-7
001514725-7
001514725-7
001514725-7
001514725-7
001515239-8 001515239-8
001515239-8
001515239-8
001515239-8
001515239-8
 
D

Don Guillett

I answered this in another forum VERY recently

Sub moveemdowntomatchSAS()
Dim i As Long
For i = 2 To Cells(Rows.Count, "a").End(xlUp).Row
If Left(Cells(i, "a"), 11) <> Left(Cells(i, "b"), 11) Then
Cells(i, "b").Resize(, 2).Insert
End If
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top