Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Add row after various groups of numbers.

I have a sheet that contains rows with customer numbers:
847300001
847300001
847300020
847300015
847300015
847300015
847300002...

What I need to do is a blank row after each groups of numbers:
847300001
847300001

847300020

847300015
847300015
847300015

847300002...

The numbers will change each time I run the report. Any way I can do this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add row after various groups of numbers.

Sub ABC()
Dim lastrow as Long, i as Long
set lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow to 2 step -1
if cells(i,1) < cells(i-1,1) then
rows(i).Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"Josh O." wrote in message
...
I have a sheet that contains rows with customer numbers:
847300001
847300001
847300020
847300015
847300015
847300015
847300002...

What I need to do is a blank row after each groups of numbers:
847300001
847300001

847300020

847300015
847300015
847300015

847300002...

The numbers will change each time I run the report. Any way I can do

this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Add row after various groups of numbers.

Tom,
Is there anything else I need to do to use this Sub. I am getting an object
error at set lastrow =

"Tom Ogilvy" wrote:

Sub ABC()
Dim lastrow as Long, i as Long
set lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow to 2 step -1
if cells(i,1) < cells(i-1,1) then
rows(i).Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"Josh O." wrote in message
...
I have a sheet that contains rows with customer numbers:
847300001
847300001
847300020
847300015
847300015
847300015
847300002...

What I need to do is a blank row after each groups of numbers:
847300001
847300001

847300020

847300015
847300015
847300015

847300002...

The numbers will change each time I run the report. Any way I can do

this?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Add row after various groups of numbers.

Remove that "Set" completely:

lastrow = cells(rows.count,1).End(xlup).Row



Josh O. wrote:

Tom,
Is there anything else I need to do to use this Sub. I am getting an object
error at set lastrow =

"Tom Ogilvy" wrote:

Sub ABC()
Dim lastrow as Long, i as Long
set lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow to 2 step -1
if cells(i,1) < cells(i-1,1) then
rows(i).Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"Josh O." wrote in message
...
I have a sheet that contains rows with customer numbers:
847300001
847300001
847300020
847300015
847300015
847300015
847300002...

What I need to do is a blank row after each groups of numbers:
847300001
847300001

847300020

847300015
847300015
847300015

847300002...

The numbers will change each time I run the report. Any way I can do

this?





--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Add row after various groups of numbers.

I removed the set, and it allows the macro to run, but it doesn't do anything
to the spreadsheet.

"Dave Peterson" wrote:

Remove that "Set" completely:

lastrow = cells(rows.count,1).End(xlup).Row



Josh O. wrote:

Tom,
Is there anything else I need to do to use this Sub. I am getting an object
error at set lastrow =

"Tom Ogilvy" wrote:

Sub ABC()
Dim lastrow as Long, i as Long
set lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow to 2 step -1
if cells(i,1) < cells(i-1,1) then
rows(i).Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"Josh O." wrote in message
...
I have a sheet that contains rows with customer numbers:
847300001
847300001
847300020
847300015
847300015
847300015
847300002...

What I need to do is a blank row after each groups of numbers:
847300001
847300001

847300020

847300015
847300015
847300015

847300002...

The numbers will change each time I run the report. Any way I can do
this?





--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add row after various groups of numbers.

See answer to later posting.

--
Regards,
Tom Ogilvy

"Josh O." wrote in message
...
I removed the set, and it allows the macro to run, but it doesn't do

anything
to the spreadsheet.

"Dave Peterson" wrote:

Remove that "Set" completely:

lastrow = cells(rows.count,1).End(xlup).Row



Josh O. wrote:

Tom,
Is there anything else I need to do to use this Sub. I am getting an

object
error at set lastrow =

"Tom Ogilvy" wrote:

Sub ABC()
Dim lastrow as Long, i as Long
set lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow to 2 step -1
if cells(i,1) < cells(i-1,1) then
rows(i).Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"Josh O." wrote in message
...
I have a sheet that contains rows with customer numbers:
847300001
847300001
847300020
847300015
847300015
847300015
847300002...

What I need to do is a blank row after each groups of numbers:
847300001
847300001

847300020

847300015
847300015
847300015

847300002...

The numbers will change each time I run the report. Any way I can

do
this?





--

Dave Peterson



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
How to differentiate groups of numbers RodJ Excel Worksheet Functions 6 September 25th 08 08:24 AM
sum only positive numbers for certain groups SteveC Excel Discussion (Misc queries) 4 August 24th 07 03:08 AM
Dragging Groups of Numbers QVCJDN Excel Discussion (Misc queries) 1 May 2nd 06 05:48 PM
Groups of numbers evanr Excel Worksheet Functions 1 February 2nd 06 11:18 PM
differences in groups of numbers pm Excel Worksheet Functions 6 August 12th 05 07:09 PM


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