Thread
:
Insert rows when data changes
View Single Post
#
3
Posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
Posts: 1,522
Insert rows when data changes
should have been
If left(Cells(i - 1, 1),1) < left(Cells(i, 1),1) Then Rows(i).Insert
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Don Guillett" wrote in message
...
Sub Sort_InsertRowsSAS()
lr = Cells(Rows.Count, 1).End(xlUp).Row
Range("A1:A" & lr).Sort Key1:=Range("A1"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
For i = lr To 2 Step -1
If Cells(i - 1, 1) < Cells(i, 1) Then Rows(i).Insert
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Russell Dawson" wrote in
message ...
In a column of periodically changing names in alphabetical order (col
A) €“ I
need to insert a row after each change in initial letter. So when the
names
have been sorted when the initial letter of the name changes from A to B
as
in Aldred to Bute there is a blank row inserted after Aldred.
It would be nice if the code could include the instruction to sort the
names
first rather than that being a separate action. Sort by column A to
include
other related data in columns to F.
Thanks
--
Russell Dawson
Excel Student
Please hit "Yes" if this post was helpful.
Reply With Quote
Don Guillett[_2_]
View Public Profile
Find all posts by Don Guillett[_2_]