Thread: Move cells down
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Move cells down

Hi Gary,

Am Fri, 10 Jun 2011 06:06:23 -0700 (PDT) schrieb GARY:

How can I move the cells in col B (plus their related data in col C
thru col I) down so they're on the same lines as the matching numbers
(after "ASMNT-NBR") in col A?


try this in a copy of your workbook:
Sub MoveItems()
Dim i As Long
Dim j As Long
Dim LRow As Long
Dim rngCell As Range

If Cells(Rows.Count, 2).End(xlUp).Row = _
WorksheetFunction.CountA(Range("B:B")) Then
j = 2
LRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LRow
If Left(Cells(i, 1), 4) = "ASMT" Then
Range("B" & j & ":I" & LRow).Cut _
Destination:=Cells(i, 2)
j = i + 1
End If
Next
End If
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2