Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with inserting a blank line on condition

Hi,

I've been programming in other languages but am very new to VB and still
getting used to its syntax style - so I'm stuck with the simplest of
problems.

What I have is an excel spreadsheet (obviously). In column A there are
text strings (names) that have been sorted into groups. So basically
groups of names down the column. All I want to do is add a complete blank
row after each name group - the number of names in each group is not
consistent.

eg

Peter
Peter
Peter

Paul
Paul

Mary
Mary
Mary
Mary

Can someone provide some help here?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with inserting a blank line on condition

Sub separategroups()
Dim lastrow as long, i as long
lastrow = cells(rows.count,1).end(xlup).row
for i = lastrow to 2 step -1
if cells(i,1).value < cells(i -1,1).value then
rows(i).Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"microsatellite" wrote in message
.com...
Hi,

I've been programming in other languages but am very new to VB and still
getting used to its syntax style - so I'm stuck with the simplest of
problems.

What I have is an excel spreadsheet (obviously). In column A there are
text strings (names) that have been sorted into groups. So basically
groups of names down the column. All I want to do is add a complete blank
row after each name group - the number of names in each group is not
consistent.

eg

Peter
Peter
Peter

Paul
Paul

Mary
Mary
Mary
Mary

Can someone provide some help here?

Thanks



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
If condition for Blank Cell Maperalia Excel Worksheet Functions 4 February 24th 09 10:55 PM
inserting a row based on a condition. Gary Excel Worksheet Functions 3 August 18th 06 02:09 PM
insert a line on condition jinvictor Excel Discussion (Misc queries) 1 June 4th 06 12:04 PM
How do you add a blank line automatically after the Subtotal line MVSD Guy Excel Worksheet Functions 0 April 20th 06 01:04 AM
copy line with 2 condition.... sal21 Excel Programming 0 October 14th 05 03:39 PM


All times are GMT +1. The time now is 02:03 PM.

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"