![]() |
|
|
|||||||
| Directory | Register | FAQ | Members List | Calendar | Mark Forums Read | 中文 |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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!!!!
|
|
|
|
|
|
#2
|
|||
|
|||
|
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
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|