Results 1 to 5 of 5

Store Values in array

Threaded View

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Store Values in array

    Hello
    I have numbers in column A (A1:A9)
    The following code extract the missing numbers and put the values in Column D

    I want to change the code so as to store the values (missing numbers) in array and finally use Msgbox to list all the values once in a message
    Sub MissingNumbers()
        Dim sh As Worksheet: Set sh = Sheet1
        Dim Lr As Long: Lr = sh.Cells(sh.Rows.Count, 1).End(xlUp).Row - 1
        Dim i As Integer, r As Integer, x As Integer, xx As Integer
        
            
            For i = 2 To Lr
                x = Val(sh.Range("A" & i + 1)) - Val(sh.Range("A" & i))
                Select Case x
                    Case Is > 1
                    For xx = 2 To x
                                    r = r + 1
                        sh.Range("D" & r).Value = Val(sh.Range("A" & i)) + xx - 1
                    Next
                End Select
            Next
    End Sub
    Here's an attachment
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Store array formula content in a VBA array
    By cgkmal in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-19-2013, 02:24 PM
  2. [SOLVED] Store value from an array in new variable
    By vizzkid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2013, 05:03 AM
  3. Store cell values in an array and return values on specific condition
    By gmalpani in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 11-27-2011, 06:43 AM
  4. Store Found values directly in array
    By cgkmal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2011, 04:41 PM
  5. Array does not store value
    By yeaster in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2008, 11:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1