View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
FredB FredB is offline
external usenet poster
 
Posts: 4
Default How to use VBA to automate sorting, cutting & pasting in Excel

Thanks Joel

It works a treat!

"Joel" wrote:

The code below checks column A againstt a customer name and paste the entire
row at the end of the list.

Sub cutandpaste()

Customer = "ABC"

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
RowCount = 1
For LoopCounter = 1 To LastRow
If Cells(RowCount, "A").Value = Customer Then
Rows(RowCount).Cut Destination:=Rows(LastRow + 1)
Rows(RowCount).Delete
Else
RowCount = RowCount + 1
End If
Next LoopCounter


End Sub

"FredB" wrote:

I have a list of data (Outstanding Orders to be filled) and I need to cut all
orders for a particular customer and paste them at the end of the list.

Can anyone please help me with the code to do this, I am just a novice at
VBA - but very keen to learn