Results 1 to 12 of 12

Looping Function for Matching Rows

Threaded View

  1. #1
    Registered User
    Join Date
    09-07-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Looping Function for Matching Rows

    Hello all,

    Need a little help converting this IF statement in VB to a loop:

    If Range("A4") = Range("A3") And Range("B4") = Range("B3") And Range("C4") = Range("C3") And Range("E4") = Range("E3") And Range("F4") = Range("F3") And Range("G4") = Range("G3") Then
    Range("D3") = Range("D3") & Range("D4")
    Range("A4:G4").Font.ColorIndex = 50
    End If
    
    If Range("A3") = Range("A2") And Range("B3") = Range("B2") And Range("C3") = Range("C2") And Range("E3") = Range("E2") And Range("F3") = Range("F2") And Range("G3") = Range("G2") Then
    Range("D2") = Range("D2") & Range("D3")
    Range("A3:G3").Font.ColorIndex = 50
    End If
    A2 B2 C2 D2 E2 F2 G2
    A3 B3 C3 D3 E3 F3 G3
    becomes:
    A2 B2 C2 D2D3 E2 F2 G2
    A3 B3 C3 D3 E3 F3 G3

    Basically, the macro goes through each row and the row below it. If col A, B, C and E, F, G match, then it combines the contents of col D, then highlights the row below it (marked as a duplicate).

    I am 1) trying to write this into a loop to go through as many as 3000 rows and 2) simply the IF statement when possible.

    Any help on this would be greatly appreciated! Thanks!
    Last edited by davesexcel; 09-07-2010 at 07:24 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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