Consulting

Results 1 to 4 of 4

Thread: Findvalue from 2 searchstrings

  1. #1

    Findvalue from 2 searchstrings

    Hello,

    i was wondering if it can be done to search with 2 string?

    Set findvalue = Sheet3.Range("B9"), Range("C1000000").Find(What:=Label5.Caption, Label6.Caption, LookIn:=xlValues, LookAt:=xlWhole)
    this doesn't seems working
    we have in our sheet Lastname Firstname Column
    when i select the JOHN DOE from the combobox
    i split it in 2 string
    and like to find those 2 string on Lastname Firstname columns on the sheet
    to change some values for this customer

    i have really no idea how to search for a customer if those are split in the sheet
    will be awesome if we can get from the sheet3 the lastname firstname and search if the match from the combobox


    Thanks.

  2. #2
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi GhostofDoom!
    I don't quite understand what you mean.

    1)If two strings are in different cells, you can write two code lines like below.
    Set findvalue1 = Sheet3.Range("B9:C1000000").Find(What:=Label5.Caption, LookIn:=xlValues, LookAt:=xlWhole)
       Set findvalue2 = Sheet3.Range("B9:C1000000").Find(What:=Label6.Caption, LookIn:=xlValues, LookAt:=xlWhole)
    2) If two strings are in the same cell, join two strings then use find().
    Set findvalue = Sheet3.Range("B9:C1000000").Find(What:=Label5.Caption & " " & Label6.Caption, LookIn:=xlValues, LookAt:=xlWhole)

  3. #3
    Hi 1976

    well i going to try explaining
    i have a sheet with columns LastName Firstname ect...
    in my form i have a combobox that will show the Lastname And Firstname on 1 line
    now i need to search for it on the sheet because i can't search 2 values in the .find section
    so my question was how can i find the combobox value on my sheet

    hope i have explained it good

  4. #4
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi GhostofDoom!
    Maybe it's helpful to upload an attachment.

Posting Permissions

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