Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default sequential number breaks

I am trying to write code that will look throught a spreadsheet and find a
break in a sequential field. i.e. , 2, 3, 5

Once the break is fouind I would place a blank line between these and
continue until I reach the end of the file

I know how to place the blank line and know how to find the end of the file,
I just can't figure the code for finding the breaks in the numbers.
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default sequential number breaks

This will only work for sequences as you quoted ie 1,2,3,5. It would need
modification for 2,4,8,10 etc.
Change the rowz range to suit your data. The start row needs to be the
second row of data as it compares to the previous row.

Sub findsequencebreak()
diff = 1
For rowz = 2 To 12
Cells(rowz, 1).Select
If Cells(rowz, 1) < Cells(rowz - diff, 1) + diff Then
Cells(rowz, 1).EntireRow.Insert
diff = 2
Else
diff = 1
End If
Next rowz
End Sub


--
Ian
--
"Cyberwolf" wrote in message
...
I am trying to write code that will look throught a spreadsheet and find a
break in a sequential field. i.e. , 2, 3, 5

Once the break is fouind I would place a blank line between these and
continue until I reach the end of the file

I know how to place the blank line and know how to find the end of the
file,
I just can't figure the code for finding the breaks in the numbers.



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
sequential number documents CLASS Excel Discussion (Misc queries) 2 February 15th 08 05:56 PM
to sinalize not sequential number an Excel Worksheet Functions 3 September 22nd 07 07:38 PM
sequential number Malissa Excel Discussion (Misc queries) 3 August 15th 05 09:54 PM
sequential number Mike W New Users to Excel 4 May 12th 05 11:38 PM
sequential number generator Karen Westerman Excel Programming 2 October 21st 03 07:39 AM


All times are GMT +1. The time now is 10:31 AM.

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

About Us

"It's about Microsoft Excel"