+ Reply to Thread
Results 1 to 3 of 3

identifying and moving matching values

  1. #1
    sean_f
    Guest

    identifying and moving matching values

    Hi,
    I need to read through the file belowidentify those records that have a
    matching code and balance and move them to a second spreadsheet.

    The moving isn't a problem but how do I filter based on the match as
    given?

    If I should read through the code how would I set the variables to
    check
    for?
    Also if I use a loop how will I know when it has finished?

    Many thanks

    sean
    Code--- Buy/Sell--------Currency-- Balance--
    AA001--Buyer---------------USD------"33,790"--
    AA001--Seller--------------- USD------"33,790"--
    AA002--Buyer---------------AUD------"773,490"--
    AA002--Seller--------------- AUD------"773,490"--
    AA003--Buyer---------------CAD------"7,616,750"--
    AA004--Buyer---------------DKK------"576,770"--
    AA005--Buyer---------------USD------"24,090,430"--
    AA005--Seller--------------- USD------"24,090,430"--
    AA006--Buyer---------------EUR------"468,126,330"--
    AA006--Seller--------------- EUR---- "468,126,330"--
    AA007--Buyer---------------HKD------"10,000"--
    AA008--Buyer---------------JPY------"2,435,917,410"--
    AA008--Seller--------------- JPY------"2,435,917,410"--
    AA009--Buyer---------------MXN------"1,002,670"--
    AA009--Seller--------------- MXN------"1,002,670"--
    --------- Seller--------------- CAD------"7,616,750"--
    --------- Seller--------------- DKK------"576,770"--
    --------- Seller--------------- HKD------"10,000"--


  2. #2
    sean_f
    Guest

    Re: identifying and moving matching values

    The code below is intended to pick out the matching pairs and color
    them blue. However it seems to act at random.
    Anyone have any suggestions. As to how to find cells that are identical
    and in adjacent rows I would be very grateful.

    Sub matching()
    Dim lastrow As Long
    lastrow = Cells(65536, 1).End(xlUp).Row


    For i = 2 To lastrow
    If Cells(i, 1).Value = Cells(i - 1, 1).Value And Cells(i, 4).Value =
    Cells(i - 1, 4) Then
    Cells(i, 1).Resize(2, 5).Font.ColorIndex = 11
    Cells(i - 1, 1).Resize(2, 5).Font.ColorIndex = 11
    End If
    Next i


    End Sub


  3. #3
    sean_f
    Guest

    Re: identifying and moving matching values

    The code below is intended to pick out the matching pairs and color
    them blue. However it seems to act at random.
    Anyone have any suggestions. As to how to find cells that are identical
    and in adjacent rows I would be very grateful.

    Sub matching()
    Dim lastrow As Long
    lastrow = Cells(65536, 1).End(xlUp).Row


    For i = 2 To lastrow
    If Cells(i, 1).Value = Cells(i - 1, 1).Value And Cells(i, 4).Value =
    Cells(i - 1, 4) Then
    Cells(i, 1).Resize(2, 5).Font.ColorIndex = 11
    Cells(i - 1, 1).Resize(2, 5).Font.ColorIndex = 11
    End If
    Next i


    End Sub


+ 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