Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FIND only 4 left part of cells (2000)

    i use this line to find in column O the value SERV...

    Set Found_INDEX = WS.Columns("O:O").Find(SERV, LookIn:=xlFormulas, LookAt:=xlWhole)

    But is possible to find SERV only in left,4 of cells in column O?
    Example:

    SERV=4500
    in column O 4500-aaaaaaaaa

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: FIND only 4 left part of cells (2000)

    If SERV will only ever appear as the first 4 characters, you could simply use:
    <code>Set Found_INDEX = WS.Columns("O:O").Find(SERV, LookIn:=xlFormulas, LookAt:=xlPart)</code>
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: FIND only 4 left part of cells (2000)

    Could you not make use of Data > Filter > Custom > Begins with?
    Regards
    Don

  4. #4
    Lounger
    Join Date
    Sep 2008
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FIND only 4 left part of cells (2000)

    If SERV is a variable,

    With WW.Columns("O:O")
    Set Found_Index = .Cells(Application.Match(SERV & "*", .Cells, 0), 1)
    End With

    If "SERV" is the string you want to match,

    With WW.Columns("O:O")
    Set Found_Index = .Cells(Application.Match("SERV*", .Cells, 0), 1)
    End With

Posting Permissions

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