#1   Report Post  
Posted to microsoft.public.excel.misc
De De is offline
external usenet poster
 
Posts: 19
Default new

Insert row at each change of surname in column
--
De
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default new

Sub insertrowifnamechg()
mc = "a"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) < Cells(i, mc) Then Rows(i).Insert
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"De" wrote in message
...
Insert row at each change of surname in column
--
De


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 364
Default new

Subtotal

"De" wrote in message
...
Insert row at each change of surname in column
--
De



  #4   Report Post  
Posted to microsoft.public.excel.misc
De De is offline
external usenet poster
 
Posts: 19
Default new

I can't see how I can insert a row using subtotals; the only option seems to
be page break. Is there a way to insert a row? Many thanks,
--
De


"Stephen" wrote:

Subtotal

"De" wrote in message
...
Insert row at each change of surname in column
--
De




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 364
Default new

I assumed you wanted to do something with the inserted rows, so I was
thinking of
Data Subtotals
which allows you to specify what you want to do on the inserted rows (sum,
average, etc.)

"De" wrote in message
...
I can't see how I can insert a row using subtotals; the only option seems
to
be page break. Is there a way to insert a row? Many thanks,
--
De


"Stephen" wrote:

Subtotal

"De" wrote in message
...
Insert row at each change of surname in column
--
De








  #6   Report Post  
Posted to microsoft.public.excel.misc
De De is offline
external usenet poster
 
Posts: 19
Default new

Showing my ignorance but is this a macro? Because it doesn't look like it
will go on the formula bar.
--
De


"Don Guillett" wrote:

Sub insertrowifnamechg()
mc = "a"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) < Cells(i, mc) Then Rows(i).Insert
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"De" wrote in message
...
Insert row at each change of surname in column
--
De



  #7   Report Post  
Posted to microsoft.public.excel.misc
De De is offline
external usenet poster
 
Posts: 19
Default new

Many thanks for this but is is a macro? I tried it as both a macro and in
the formula bar but I'm not confident with macros so I might not have got it
right.
--
De


"Don Guillett" wrote:

Sub insertrowifnamechg()
mc = "a"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) < Cells(i, mc) Then Rows(i).Insert
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"De" wrote in message
...
Insert row at each change of surname in column
--
De



  #9   Report Post  
Posted to microsoft.public.excel.misc
De De is offline
external usenet poster
 
Posts: 19
Default new

Many tks for the help.
--
De


"Don Guillett" wrote:

Sub insertrowifnamechg()
mc = "a"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) < Cells(i, mc) Then Rows(i).Insert
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"De" wrote in message
...
Insert row at each change of surname in column
--
De



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"