+ Reply to Thread
Results 1 to 3 of 3

Remaining Numbers from a List that are not used

  1. #1
    Lorence
    Guest

    Remaining Numbers from a List that are not used

    Say I have in the following cells

    A1 134
    A2 567
    A3 368

    I want C5 to show the remaining numbers from the list of
    1,2,3,4,5,6,7,8,9
    i.e. 2, 9

    This required over approx 25 groups of cells in a sheet


    Anyone done this before?

    I am not good at VBA, but can manage most Excel functions happily

    Lorence

  2. #2
    Henry
    Guest

    Re: Remaining Numbers from a List that are not used

    Lorence,

    Try:
    Sub Mytest()
    Dim L As String, TestST As String
    Dim X, Y
    TestST = "123456789"
    L = Range("A1").Text & Range("A2").Text & Range("A3").Text
    For X = 1 To 9
    Y = 1
    Do

    If Mid(L, X, 1) = Mid(TestST, Y, 1) Then _
    TestST = Left(TestST, Y - 1) & Right(TestST, Len(TestST) - Y)
    Y = Y + 1
    Loop Until Y > Len(TestST)
    Next X
    Range("C5").Value = TestST
    End Sub


    Henry


    "Lorence" <[email protected]> wrote in message
    news:[email protected]...
    > Say I have in the following cells
    >
    > A1 134
    > A2 567
    > A3 368
    >
    > I want C5 to show the remaining numbers from the list of
    > 1,2,3,4,5,6,7,8,9
    > i.e. 2, 9
    >
    > This required over approx 25 groups of cells in a sheet
    >
    >
    > Anyone done this before?
    >
    > I am not good at VBA, but can manage most Excel functions happily
    >
    > Lorence




  3. #3
    Lorence
    Guest

    Re: Remaining Numbers from a List that are not used

    On Tue, 14 Jun 2005 00:35:56 GMT, "Henry" <[email protected]>
    wrote:

    >Lorence,
    >
    >Try:
    >Sub Mytest()
    >Dim L As String, TestST As String
    >Dim X, Y
    >TestST = "123456789"
    >L = Range("A1").Text & Range("A2").Text & Range("A3").Text
    >For X = 1 To 9
    >Y = 1
    >Do
    >
    >If Mid(L, X, 1) = Mid(TestST, Y, 1) Then _
    > TestST = Left(TestST, Y - 1) & Right(TestST, Len(TestST) - Y)
    >Y = Y + 1
    >Loop Until Y > Len(TestST)
    >Next X
    >Range("C5").Value = TestST
    >End Sub
    >
    >
    >Henry
    >


    Works brilliantly - thks

    Lorence

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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