Thread: Move cells down
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Move cells down

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


On Nov 30, 12:55*pm, gary wrote:
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