Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Seperating Rows

I have an array of data. I want to insert lines in
between rows where the value in column "A" changes. For
instance, the value in cell A1 through A10 is 522, then
A11 goes to 524. I want to insert a blank row to seperate
the two. The code that I wrote to attempt that failed
miserably. Not sure where I went wrong, but here's what I
did:

Sub sepLATAs()
Range("a3:a150").Select
Dim acell As Range

For Each acell In Selection

If acell.Value < acell.Offset(-1, 0) Then
acell.EntireRow.Insert
On Error Resume Next
End If
Next acell

End Sub

Any help would be appreciated.

Thanks,

Kevin G
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Seperating Rows

Kevin,

Not sure if this is of interest to you, but Excel has a SubTotal function
under the Data menu. This will separate your groups and give you subtotals.

Once you get used to using it, you can record and modify a macro to do it
automatically.

steve

"Kevin G" wrote in message
...
Chip,

Worked perfect!!! Thanks for the quick response!!!

Kevin G.

-----Original Message-----
Kevin,

Try code like the following:

Dim RowNdx As Long
For RowNdx = Cells(Rows.Count, "A").End(xlUp).Row To 2

Step -1
If Cells(RowNdx, "A") < Cells(RowNdx - 1, "A") Then
Rows(RowNdx).EntireRow.Insert
End If
Next RowNdx


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Kevin G" wrote in message
...
I thought about this and an earlier problem that was

kind
of similar. What I think I need to do is start from the
bottom of the array and work my way up. If that makes
sense to anyone, how do I start at the bottom instead of
the top??

Again, any help would be appreciated.

Thanks,

Kevin G
-----Original Message-----
I have an array of data. I want to insert lines in
between rows where the value in column "A" changes.

For
instance, the value in cell A1 through A10 is 522, then
A11 goes to 524. I want to insert a blank row to
seperate
the two. The code that I wrote to attempt that failed
miserably. Not sure where I went wrong, but here's

what
I
did:

Sub sepLATAs()
Range("a3:a150").Select
Dim acell As Range

For Each acell In Selection

If acell.Value < acell.Offset(-1, 0) Then
acell.EntireRow.Insert
On Error Resume Next
End If
Next acell

End Sub

Any help would be appreciated.

Thanks,

Kevin G
.



.



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
seperating columns sbinva Excel Discussion (Misc queries) 1 November 11th 08 10:17 PM
Seperating text Richard Excel Discussion (Misc queries) 8 June 29th 06 10:21 PM
Seperating Rows By Price Difference mxalix257 New Users to Excel 1 June 16th 06 04:58 AM
Seperating First and Last Names WilsonLA Excel Discussion (Misc queries) 4 April 12th 06 05:28 PM
Seperating worksheets Arun Naidu Excel Discussion (Misc queries) 0 March 8th 05 01:21 AM


All times are GMT +1. The time now is 09:14 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"