Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to extract the row number of a cell with certain value

Hi, I am trying to extract the row number of a cell with a particular
value. For example, I have a cell with the value '1-A54' in it, and I
am trying to get the row number where this value appear. Can anybody
tell me how to write it in VBA? Thanks a lot.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default how to extract the row number of a cell with certain value

Hi There,
Think this will work. Just from memory so please forgive me if I have missed
something.

Dim RowNum As Integer
Dim ColNum as Integer
Dim RowFoundOn as Integer
Dim ImFinished as Boolean

RowNum = 0
ColNum = 1 '*** set to column A, change to the column containing values
you are searching for.
Do
RowNum = RowNum + 1
Cells(RowNum,ColNum).Select
If Cells(RowNum,ColNum).Value = "1-A54"
RowFoundOn = ActiveCell.Row
ImFinished = True
End If
Loop Until ImFinished

All the best,

Steve Wilson.


"houston city" wrote in message
...
Hi, I am trying to extract the row number of a cell with a particular
value. For example, I have a cell with the value '1-A54' in it, and I
am trying to get the row number where this value appear. Can anybody
tell me how to write it in VBA? Thanks a lot.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default how to extract the row number of a cell with certain value

Hi
one way:
msgbox application.match("1-A54",Range("A1:A1000"),0)

or use the Find method (see VBA help for an example)

-----Original Message-----
Hi, I am trying to extract the row number of a cell with

a particular
value. For example, I have a cell with the value '1-A54'

in it, and I
am trying to get the row number where this value appear.

Can anybody
tell me how to write it in VBA? Thanks a lot.



*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract everything to the right in cell when a number is encounter Matt Excel Worksheet Functions 4 January 9th 08 03:25 PM
how do i extract a number from a cell with no spaces? Mulvaney Excel Worksheet Functions 4 July 26th 05 09:15 PM
Extract sheet name/number to cell claytorm Excel Discussion (Misc queries) 1 June 27th 05 11:34 AM
Extract number in middle of cell SCOOBYDOO Excel Worksheet Functions 2 June 9th 05 02:48 PM
Extract number from name of cell Matt Excel Programming 1 January 14th 04 08:46 PM


All times are GMT +1. The time now is 03:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"