Consulting

Results 1 to 4 of 4

Thread: Macros match / Lookup

  1. #1
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location

    Macros match / Lookup

    Dear all

    I wane a code likes Vb or Macros if it can match the value Form active Sheets1 Range “L3 to L” ( which that’s unknown since too many data to down )to work Sheets2 the Range from “B3 to B” if the value can matched than Sheet1 the targets Row from A to L highlighted yellow,


    Does it workable? That I don’t know but wanna someone can help


    Thanks

  2. #2
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    Sorry, bud. Need to work on your translation.

  3. #3
    VBAX Mentor MaximS's Avatar
    Joined
    Sep 2008
    Location
    Stoke-On-Trent
    Posts
    360
    Location
    try that:

    [vba]
    Option Explicit
    Sub Checker()
    Dim Wb As Workbook
    Dim Sh, Sh1 As Worksheet
    Dim LRow, LRow1, i As Long
    Dim x As String
    Set Wb = ThisWorkbook
    'Replace 1 with Worksheet Name ("Name") if needed
    Set Sh = Wb.Worksheets(1)
    'Replace 2 with Worksheet Name ("Name") if needed
    Set Sh1 = Wb.Worksheets(2)
    'LRow will check for the last used row in Sheet 1
    LRow = Sh.Range("A" & Rows.Count).End(xlUp).Row
    'LRow1 will check for the last used row in Sheet 2
    LRow1 = Sh1.Range("A" & Rows.Count).End(xlUp).Row

    'If you have a header change i = 1 to i = 2
    For i = 1 To LRow
    On Error Resume Next
    x = WorksheetFunction.Match(Sh.Cells(i, "L").Value, _
    'If you have a header change B1 to B2
    Sh1.Range("B1:B" & LRow1), 0)
    On Error GoTo 0
    If x <> "" Then
    Sh.Range("A" & i & ":L" & i).Interior.ColorIndex = 6
    End If
    x = ""
    Next i

    End Sub
    [/vba]

  4. #4
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location
    Dear MaximS

    Thanks The code and it work perfectly.

Posting Permissions

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