Move cells down
On Jun 9, 9:35*am, Claus Busch wrote:
Hi Gary,
Am Thu, 9 Jun 2011 09:08:18 -0700 (PDT) schrieb GARY:
How can I move the cells in col B down so they're on the same lines as
the matching numbers (after "ASMNT-NBR") in col A? *I want the result
to look like this:
* * * * * * * * * * Col A * * * * * * * * * * * Col B
ASMT-NBR *008102510-5 * 008102510-5
PAYMT * * * * COLNBR
* 1 * * * * *6068266
REDAMT
ASMT-NBR *008102976-3 * 008102976-3
try:
Sub MoveItems()
Dim i As Long
Dim LRow As Long
Dim rngCell As Range
If Cells(Rows.Count, 2).End(xlUp).Row = _
* * WorksheetFunction.CountA(Range("B:B")) Then
Columns("B").Insert
i = 1
LRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each rngCell In Range("A1:A" & LRow)
* * If Left(rngCell, 4) = "ASMT" Then
* * * * rngCell.Offset(0, 1) = Cells(i, 3)
* * * * i = i + 1
* * End If
Next
Columns("C").Delete
End If
End Sub
Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Wow! That worked!!!
But I have an expansion.
For each cell in col B, there is related data in col C thru col I.
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?
|