Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Missing Numbers from a Range


Hello All

Hope one of you can help, I need to create a macro that can identify
missing nos. from a range I.e
Range Missing no.
1 4
2 6
3
5
7

Thanks in advance


--
robmeister
------------------------------------------------------------------------
robmeister's Profile: http://www.excelforum.com/member.php...o&userid=24364
View this thread: http://www.excelforum.com/showthread...hreadid=379607

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Missing Numbers from a Range


Assuming your first column starts from A1, run this macro:

Private Sub CommandButton1_Click()

Set rngStart = Range("A1")
Set rngResult = Range("B1")

Set rngSearch = Range(rngStart, rngStart.End(xlDown))
j = 0
i = 1

For Each cl In rngSearch
If i 1 Then
diff = rngSearch(i) - rngSearch(i - 1)
If diff 1 Then
For k = 2 To diff
rngResult.Offset(j, 0) = rngSearch(i - 1) + k - 1
j = j + 1
Next
End If
End If
i = i + 1
Next
End Sub



Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=379607

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Missing Numbers from a Range


Thank you Mangesh that's worked.
CHeers :)


--
robmeister
------------------------------------------------------------------------
robmeister's Profile: http://www.excelforum.com/member.php...o&userid=24364
View this thread: http://www.excelforum.com/showthread...hreadid=379607

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Missing Numbers from a Range


Glad it helped. Thanks for the feedback.

Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=37960

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
Missing row numbers kingfisher Excel Discussion (Misc queries) 2 January 21st 10 10:57 PM
Row Numbers Missing denisej77 Excel Worksheet Functions 1 November 18th 08 02:21 PM
Get Missing Numbers rc Excel Discussion (Misc queries) 2 December 4th 07 09:50 PM
to find missing serial numbers in randomly generated numbers B.H. Hadi Excel Worksheet Functions 2 December 1st 05 10:56 PM
Missing Numbers Soniya[_2_] Excel Programming 5 December 18th 03 02:25 PM


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