Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert row between different item

Dear all,

Please see the following data:

Part no. Loacation Date
637A A1 10-MAY-2004
807K B1 11-MAY-2004
639A B2 12-MAY-2004
807K C1 12-MAY-2004
807K D1 15-MAY-2004


How can I use macro or function to sort the data by part
no. and then insert a row between each different part no
automatically. Like the below result:

Part no. Loacation Date
637A A1 10-MAY-2004

639A B2 12-MAY-2004

807K B1 11-MAY-2004
807K C1 12-MAY-2004
807K D1 15-MAY-2004










  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert row between different item

do it manually and record it in a new macro
Tools - Macro - Record new macro

open the new macro and edit to your suit
Tools - Macro - Macros - Edit


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert row between different item

Try

Sub InsertRow()
Dim lRow As Long

For lRow = Range("a" & Rows.Count).End(xlUp).Row To 2 Step -1
If Cells(lRow - 1, "a").Value < "" And Cells(lRow, "a").Value <
"" Then
If Cells(lRow, "a").Value < Cells(lRow - 1, "a") Then
Rows(lRow).Insert
End If
End If
Next lRow
End Su

--
Message posted from http://www.ExcelForum.com

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
how do I insert Item numbers EJ Jacques Excel Discussion (Misc queries) 1 May 24th 08 12:30 AM
I can't insert a calculated item in a pivot table VicWest Excel Discussion (Misc queries) 1 June 5th 07 10:25 AM
automatically insert date when I scan an item GregB Excel Discussion (Misc queries) 3 February 15th 07 05:47 PM
Removing a subtotal from an insert item in a pivot table dianeha Excel Discussion (Misc queries) 2 July 21st 06 10:33 PM
Why is the menu item "Insert - Name" greyed out? Chuck Excel Discussion (Misc queries) 2 March 7th 05 05:25 PM


All times are GMT +1. The time now is 12:56 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"