Made In China Talk  

Go Back   Made In China Talk > International Business Talk > Import > Food & Beverage
Directory Register FAQ Members List Calendar Mark Forums Read 中文


How do you create an Excel macro that inserts a line in a worksheet to separate repeated data?


Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2009, 02:58 AM
culture culture is offline
Senior Member
 
Join Date: Dec 2008
Posts: 3,133
Feedback: (0)
Default How do you create an Excel macro that inserts a line in a worksheet to separate repeated data?

I have an order list where account numbers and addresses are repeated if more than one item is ordered. How can I get a line to insert between the different acct #'s.For example if this data were imported Acct # would be in cells 1:1, 1:2, 1:3, etc. I would like to have a line inserted after a group of an account number is repeated so that a printout of the data would look cleaner.What I haveAcct # Item Address123 Apple 123 Main St123 Banana 123 Main St124 Orange 456 Any Street124 Pear 456 Any Street126 Banana 789 Other Ave125 Orange 111 Centeral Blvd127 Pineapple 321 Fruit StWhat I wantAcct # Item Address123 Apple 123 Main St123 Banana 123 Main St124 Orange 456 Any Street124 Pear 456 Any StreetSomeone PLEASE help!!!!
Reply With Quote


  #2  
Old 07-06-2009, 02:58 AM
Canada Canada is offline
Senior Member
 
Join Date: Dec 2008
Posts: 2,762
Feedback: (0)
Default How do you create an Excel macro that inserts a line in a worksheet to separate repeated data?

This should do what you need. I assumed that the account numbers are only in column A.Sub InsertRows()Range("A3").ActivateDo Until ActiveCell. Value = "" If ActiveCell.Value <> ActiveCell.Offset (-1, 0).Value _ And ActiveCell.Offset (-1, 0).Value <>"" Then ActiveCell.EntireRow. Insert End IfActiveCell. Offset(1, 0).ActivateLoopEnd Sub
Reply With Quote
Reply



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


| UK Articles | find a job in china | China Video Chat | Business | Free Articles | Luxury Homes in the US | Bluehost coupons | Bluehost coupons | Hostmonster coupons | Hostmonster coupons | Online Marketing Tips - Earn Cash Money

All times are GMT +9. The time now is 05:19 PM.


All rights reserved. Copyright © 2007 Made In China Talk