Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Find text in column

Column E typically contains the following text entries.

As part of a module I need to find the row of the cell in which a specified
string appears.

iRowNum is the row sought.

sItem is the string to search for.

NB. There are several blanks cells between entries in the column.



iRowNum = ...sItem...?



D01-001

D01-002

D01-003

D01-004

..

..

..

D02-003

D02-004

D02-005

....



Many thanks,



Francis Hookham


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Find text in column

This is one way:

Sub fndiRowNum()
sItem = 4
With ActiveSheet.UsedRange
Set C = .Find(sItem, LookIn:=xlValues)
If Not C Is Nothing Then
x = C.Address
iRowNum = Range(x).Row
End If
End With
MsgBox iRowNum
End Sub


"Francis Hookham" wrote:

Column E typically contains the following text entries.

As part of a module I need to find the row of the cell in which a specified
string appears.

iRowNum is the row sought.

sItem is the string to search for.

NB. There are several blanks cells between entries in the column.



iRowNum = ...sItem...?



D01-001

D01-002

D01-003

D01-004

..

..

..

D02-003

D02-004

D02-005

....



Many thanks,



Francis Hookham



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Find text in column

Of course your sItem would be a different value but I used 4 just to run a
test.

"Francis Hookham" wrote:

Column E typically contains the following text entries.

As part of a module I need to find the row of the cell in which a specified
string appears.

iRowNum is the row sought.

sItem is the string to search for.

NB. There are several blanks cells between entries in the column.



iRowNum = ...sItem...?



D01-001

D01-002

D01-003

D01-004

..

..

..

D02-003

D02-004

D02-005

....



Many thanks,



Francis Hookham



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Find text in column

Great! Thanks - not sure I undestand how it works but it does - I must study
it and get to grips with it.


"JLGWhiz" wrote in message
...
This is one way:

Sub fndiRowNum()
sItem = 4
With ActiveSheet.UsedRange
Set C = .Find(sItem, LookIn:=xlValues)
If Not C Is Nothing Then
x = C.Address
iRowNum = Range(x).Row
End If
End With
MsgBox iRowNum
End Sub


"Francis Hookham" wrote:

Column E typically contains the following text entries.

As part of a module I need to find the row of the cell in which a
specified
string appears.

iRowNum is the row sought.

sItem is the string to search for.

NB. There are several blanks cells between entries in the column.



iRowNum = ...sItem...?



D01-001

D01-002

D01-003

D01-004

..

..

..

D02-003

D02-004

D02-005

....



Many thanks,



Francis Hookham





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
Find the first cell to contain text in a column M Excel Discussion (Misc queries) 7 February 26th 09 07:46 PM
Find a text from a column in a text string within another column? Mike Garcia[_2_] New Users to Excel 1 October 22nd 08 06:50 PM
FIND LAST COPY OF A TEXT IN A COLUMN nastech Excel Discussion (Misc queries) 10 October 6th 07 03:11 AM
Find text in Column or Range Name Lankchevy Excel Programming 2 December 13th 05 04:21 PM
Find text in Column to sum Juan Excel Programming 3 July 27th 04 10:27 PM


All times are GMT +1. The time now is 09:05 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"