Address of searched element

Solved/Closed
sunny2u86 Posts 14 Registration date Thursday February 2, 2012 Status Member Last seen June 4, 2012 - Mar 12, 2012 at 12:29 PM
 SoleilDeWindows1333333 - Mar 31, 2012 at 06:51 AM
Hello,
hi
help me pls...

my question is

--- A----- B---- c
1 as
2 ad
3 sd
4 dg
5 ki
6 we
7 rt
8 ty
9 ru

my question is that is there is any vba code that will give me the location of the searched element,say i searched"ki" then it wiil show result "5" in column B1 or c1 any...


Related:

6 responses

aquarelle Posts 7141 Registration date Saturday April 7, 2007 Status Moderator Last seen December 19, 2024 491
Mar 14, 2012 at 02:35 PM
Hi,

Try this macro :
Sub Search()
Dim word As String
Dim NRWord As Long
word = InputBox("Type word to search for :", "Search")
Cells.Find(What:=word, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
NRWord = ActiveCell.Row
Range("C1").Value = NRWord
End Sub


Best regards
hi many thanks for your kind help!!
it really works for me ...
thanks again..
SoleilDeWindows1333333
Mar 31, 2012 at 06:51 AM
cOOL ! Very great and nice :-) !
SoleilDeWindows1333333
Mar 31, 2012 at 06:51 AM
And thank you very much ! It is very help !
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Mar 13, 2012 at 01:29 AM
in c1 type this formula

=INDEX($A$1:$A$100,MATCH("ki",$B$1:$B$100,0))
sunny2u86 Posts 14 Registration date Thursday February 2, 2012 Status Member Last seen June 4, 2012
Mar 13, 2012 at 11:24 AM
hi thanks for your help but can you provide me a vbs code that will search the value in the string from range A:A100 and then give the address of the cell in which that value was found(say 5) and then store that value in a variable (say integer x)
--- A----- ----------------------B------------------------------- c
1 thanks for your help
2 string from range
3 type this formula
4 Configuration: Windows XP
5 fan not working.
6 Address of searched element
7 can you please help me
8 i am waiting
9 for your response


suppose i am searching for"working" then x integer will store 5 as the cell address, so that i'll make it uses in my calculation...

thanks!
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Mar 13, 2012 at 10:27 PM
=INDEX($A$1:$A$100,MATCH("*working*",$B$1:$B$100,0))
sunny2u86 Posts 14 Registration date Thursday February 2, 2012 Status Member Last seen June 4, 2012
Mar 14, 2012 at 11:04 AM
HI

This part of code is not working..

can u provide me the vba code that automatically search the element in the range a1 to a100 and then store the result in x integer.


thankx
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Mar 15, 2012 at 01:29 AM
is not formula working
your file"sunny.xls" is uploaded here

http://speedy.sh/sju4Y/sunny.xls


download and see C1.