[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

marcro to assign a variable to the row number of a cell contains a particular word

HI
I want to assign an variable  in excel marco which returns  the row number of a cell in Colume A with the word "find_me".  The word "find_me only exist one time in column A.
How can I do it?

Thanks
Peter
0
peteryau
Asked:
peteryau
  • 3
  • 2
  • 2
  • +1
1 Solution
 
andrewssd3Commented:
Does the cell consist only of the word "find_me", or does it just contain the word, like "can you find_me in this cell".  Are you worried about upper or lower case?
0
 
Saqib Husain, SyedEngineerCommented:

activesheet.range("A:A").find("find_me").row
0
 
TinTombStoneCommented:
A simple solution

Dim foundRow As Long

    Cells.Find("find_me", Range("A1"), , xlByColumns).Activate

    foundRow = ActiveCell.Row

    MsgBox foundRow

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
TinTombStoneCommented:
Although ssagibh's solution is simpler and better.  I always forget the really easy methods!
0
 
peteryauAuthor Commented:
Yes, the word find_me is case sensitive and only of the word "find_me"
0
 
peteryauAuthor Commented:
how to show the row number  which has exactly the value "find_me"?
ssagibh's solution shows the row number of "find_me_too"  which occurs before "find_me"
0
 
Saqib Husain, SyedEngineerCommented:
activesheet.range("A:A").find("find_me",,,xlwhole).row
0
 
Saqib Husain, SyedEngineerCommented:
activesheet.range("A:A").find("find_me",,,xlwhole,,,true).row

will also match the case
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now