ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   creating macro to seperate lines (https://www.excelbanter.com/excel-programming/439702-creating-macro-seperate-lines.html)

Macro To Seperate Unique value

creating macro to seperate lines
 
how can i create a macro to seperate lines by a uniqe value.e.g if i have
john doe for 10 lines and johnsmith for 20 rows, is there a macro to sperate
each unique value?

Gord Dibben

creating macro to seperate lines
 
Sub InsertRow_At_Change()
'Sandy Mann July 1st, 2007
Dim LastRow As Long
Dim X As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False

For X = LastRow To 3 Step -1
If Cells(X, 1).Value < Cells(X - 1, 1).Value Then
If Cells(X, 1).Value < "" Then
If Cells(X - 1, 1).Value < "" Then
Cells(X, 1).entirerow.Insert Shift:=xlDown
End If
End If
End If
Next X
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Thu, 18 Feb 2010 11:16:07 -0800, Macro To Seperate Unique value <Macro To
Seperate Unique wrote:

how can i create a macro to seperate lines by a uniqe value.e.g if i have
john doe for 10 lines and johnsmith for 20 rows, is there a macro to sperate
each unique value?




All times are GMT +1. The time now is 03:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com