Solved

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

Posted on 2011-09-05
8
339 Views
Last Modified: 2012-05-12
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
Comment
Question by:peteryau
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 17

Expert Comment

by:andrewssd3
ID: 36482812
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
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 36482862

activesheet.range("A:A").find("find_me").row
0
 
LVL 6

Expert Comment

by:TinTombStone
ID: 36482959
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 6

Expert Comment

by:TinTombStone
ID: 36483054
Although ssagibh's solution is simpler and better.  I always forget the really easy methods!
0
 

Author Comment

by:peteryau
ID: 36483108
Yes, the word find_me is case sensitive and only of the word "find_me"
0
 

Author Comment

by:peteryau
ID: 36483128
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
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 36483134
activesheet.range("A:A").find("find_me",,,xlwhole).row
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 36483149
activesheet.range("A:A").find("find_me",,,xlwhole,,,true).row

will also match the case
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question