Solved

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

Posted on 2011-09-05
8
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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!

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

728 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