Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to use VBA to automate sorting, cutting & pasting in Excel?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to use VBA to automate sorting, cutting & pasting in Excel?

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Cutting and Pasting from SQL Table to Excel Sheet Chaplain Doug Excel Discussion (Misc queries) 0 April 25th 08 04:55 PM
Cutting and Pasting in Excel Rev. Munchkindad Excel Discussion (Misc queries) 19 September 5th 07 08:40 PM
Cutting/pasting from Excel.Application object - missing the obvious? David Evans[_3_] Excel Programming 1 April 19th 07 09:44 AM
can excel auto correct when cutting and pasting bsmile29 Excel Discussion (Misc queries) 5 June 21st 06 09:06 PM
cutting a row and pasting to a column wolfdogg[_2_] Excel Programming 1 August 23rd 05 09:15 PM


All times are GMT +1. The time now is 04:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"