Solved

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

Posted on 2011-09-05
8
308 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
Comment Utility
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
Comment Utility

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

Expert Comment

by:TinTombStone
Comment Utility
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
 
LVL 6

Expert Comment

by:TinTombStone
Comment Utility
Although ssagibh's solution is simpler and better.  I always forget the really easy methods!
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

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

Author Comment

by:peteryau
Comment Utility
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
Comment Utility
activesheet.range("A:A").find("find_me",,,xlwhole).row
0
 
LVL 43

Accepted Solution

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

will also match the case
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to open excel file size more than 2 GB 3 41
copy range to another sheet problem 4 23
Filter and delete 6 14
Excel formula 6 21
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now