Results 1 to 2 of 2

Thread: Selecting a Row base on an array lookup

  1. #1

    Post Selecting a Row base on an array lookup



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi Guys,


    I am having a problem selecting the corresponding row from a range look up
    Sorry if this is a noob question but I am new.. Thanks in advance for anyone who replies much appreciated

    Here is my code

    Code:
    Sub holidaysSelect()
    
    Dim Holiday As Variant, LastCol As Long, c As Range, mcount As Long
    
    
    With ActiveSheet
        LastCol = .Range("A1").SpecialCells(xlCellTypeLastCell).Column '<--- I added this line to find the last column             
    End With
    
    
    Holiday = Array("A250", "A251") '<----- Column C:C Contains all the codes and I am trying to look for these two
    
    
    For Each c In Intersect(Range("C:C"), ActiveSheet.UsedRange)
        For mcount = LBound(Holiday) To UBound(Holiday)
            If c.Value = Holiday(mcount) Then
               c.Value = Range( '<--- I Want to be able to select the row from Column A to the last column (code above *LastCol*)     
                Selection.Font.Bold = True       
                 With Selection.Interior
                  .Pattern = xlSolid
                  .PatternColorIndex = xlAutomatic
                  .ThemeColor = xlThemeColorLight2
                  .TintAndShade = 0.799981688894314
                  .PatternTintAndShade = 0 '<---- pulled from macro code I wanted to bold the row and add some color
                           
                Exit For
            End If
        
        
        Next
    Next
    
    
    End Sub


    Thanks again,

    M
    Last edited by Bob Phillips; 2015-03-11 at 10:00 AM. Reason: Added code tags

  2. #2
    Solved

    Code:
    For Each c In Intersect(Range("C:C"), ActiveSheet.UsedRange)
        For mcount = LBound(holiday) To UBound(holiday)
            If c.Value = holiday(mcount) Then
                Range("A" & c.Row, Cells(c.Row, LastCol).Address).Select
                Selection.Font.Bold = True
    Last edited by Bob Phillips; 2015-03-11 at 10:01 AM. Reason: Added code tags

Posting Permissions

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