![]() |
#1
|
|||
|
|||
![]()
I have one workbook that contains two sheets. Sheet one has 17 columns and 100k rows. An example of what a row and columns looks like from sheet one:
provcpt1cpt2cpt3cpt4cpt5cpt6cpt7cpt8cpt9cpt10cpt11cpt12cpt13cpt14john doe167L8641101672193301933115172216715000232t84.5536380 Sheet two contains 1 column with 226 various numbers. Example: PROC_CD0010 0048T 0051T 0099T 0154T 0285T 0694 0695 0745 1192 11980 11981 11982 11983 138 I want the my macro to take the 226 proc cds and look for them on sheet 1 and if they find a proc cd within any column and row, highlight the entire row. The code I have is: Sub HighlightRowsWithMyNumbers() Dim R As Range, vA As Variant, i As Long, j As Long, k As Long, mynums As Variant mynums = Sheets("sheet2").Range("a2:a226").Value Set R = ActiveSheet.UsedRange vA = R.Value Application.ScreenUpdating = False For i = LBound(mynums, 1) To UBound(mynums, 1) For j = LBound(vA, 1) To UBound(vA, 1) For k = LBound(vA, 2) To UBound(vA, 2) If vA(j, k) = mynums(i) Then R.Cells(j, k).EntireRow.Interior.Color = vbYellow Exit For End If Next k Next j Next i End Sub When I run it, the response is subscript our of range error. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I assign a macro to a button when the macro is in my personal workbook? | foolios | Excel Programming | 2 | 07-27-2011 02:41 PM |