PDA

View Full Version : Findvalue from 2 searchstrings



GhostofDoom
12-07-2019, 02:35 AM
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.

大灰狼1976
12-08-2019, 09:48 PM
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)

GhostofDoom
12-09-2019, 03:52 AM
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 :)

大灰狼1976
12-09-2019, 04:36 AM
Hi GhostofDoom!
Maybe it's helpful to upload an attachment.