macro in excel

  • Thread starter Macro To Seperate Unique value
  • Start date
M

Macro To Seperate Unique value

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 lines, is there a macro to sperate
each unique value?
 
P

Per Jessen

Hi

Try something like this:


Sub InsertRow()
TargetCol = "A"
FirstRow = 2
LastRow = Range(TargetCol & 1).End(xlDown).Row
For rw = LastRow To FirstRow + 1 Step -1
If Range(TargetCol & rw) <> Range(TargetCol & rw - 1) Then
Rows(rw).EntireRow.Insert
End If
Next
End Sub

Regards,
Per

"Macro To Seperate Unique value"
 
G

Gord Dibben

See also your post from 4 minutes ago.

Not necessary to multi-post.

Wastes a lot of time and effort.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top