Thread: Move cells down
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
GARY GARY is offline
external usenet poster
 
Posts: 117
Default Move cells down

On Jun 10, 6:46*am, Claus Busch wrote:
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


Thank you, thank you, thank you!!!!!