Results 1 to 8 of 8

How to apply the codes for 2 columns in For each... in...

Threaded View

  1. #1
    Registered User
    Join Date
    07-01-2015
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    66

    How to apply the codes for 2 columns in For each... in...

    I want to apply the code below for Column T without Copy the same codes.
    Apply for both Column S and Column T

    Any way to do this ?
    Thanks in advance .


    For Each rng In Wkb1.ActiveSheet.UsedRange.Columns("S").Cells
            str = WorksheetFunction.Vlookup(rng.Value, Wkb2.ActiveSheet.UsedRange.Columns("J:P"), 7, False)
            str2 = WorksheetFunction.Vlookup(rng.Value, Wkb2.ActiveSheet.UsedRange.Columns("J:N"), 5, False) 'reject column
                    
            If Err.Description = "" Then ' ID found...
                    If str = "Open A/R" Or str = "Merged" Then
                        rng.Interior.Color = RGB(0, 0, 255) ' blue
                    Else
                        rng.Interior.Color = RGB(0, 255, 0) ' green
                    End If
                    
                 ' Reject column
                    If str2 = "2" Then
                        rng.Interior.Color = RGB(255, 255, 0) ' yellow
                    Else
                    'do nothing
                    End If
            Else ' no ID found...
                Err.Clear
            End If
        Next rng
    Last edited by fluffyvampirekitten; 07-31-2015 at 01:28 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 02-05-2014, 12:34 AM
  2. [SOLVED] APPLY Header Codes
    By diakonos1984 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2013, 03:48 PM
  3. [SOLVED] How to transpose columns to row using vba codes
    By ricardo2012 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-04-2012, 04:55 PM
  4. [SOLVED] I have two columns (A) and (G) that have like product codes however
    By genesisoxygen@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-07-2006, 01:05 PM
  5. I have two columns (A) and (G) that have like product codes however
    By genesisoxygen@gmail.com in forum Excel General
    Replies: 1
    Last Post: 08-04-2006, 03:25 PM
  6. [SOLVED] I have two columns (A) and (G) that have like product codes however
    By genesisoxygen@gmail.com in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-04-2006, 03:25 PM
  7. Replies: 0
    Last Post: 04-28-2006, 01:00 PM

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