ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Partial Searching on a row (https://www.excelbanter.com/excel-programming/353992-partial-searching-row.html)

wilmanleung

Partial Searching on a row
 

Hi all,

I'm a novice in Excel VBA and have been stuck finding a solution to the
problem below:

I need to do a partial matching for a string, "/F". Basically there is
a floor (e.g. 13/F, 29/F) in every row, but not always in the same
column. The one thing the floor cells have in common is the string
above.

I want to search for this string on every row and return the full
cell.

Is there any way I could do this in VBA or maybe simply using
formulae.

I'd very grateful on any light shed on this.

Best wishes

Will


--
wilmanleung
------------------------------------------------------------------------
wilmanleung's Profile: http://www.excelforum.com/member.php...o&userid=31800
View this thread: http://www.excelforum.com/showthread...hreadid=515240


Toppers

Partial Searching on a row
 
Will,

Somethig along these lines:

Sub a()
With Worksheets(1).Range("a1:Z500")
Set c = .Find("/F", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Value & " found at " & c.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub

"wilmanleung" wrote:


Hi all,

I'm a novice in Excel VBA and have been stuck finding a solution to the
problem below:

I need to do a partial matching for a string, "/F". Basically there is
a floor (e.g. 13/F, 29/F) in every row, but not always in the same
column. The one thing the floor cells have in common is the string
above.

I want to search for this string on every row and return the full
cell.

Is there any way I could do this in VBA or maybe simply using
formulae.

I'd very grateful on any light shed on this.

Best wishes

Will


--
wilmanleung
------------------------------------------------------------------------
wilmanleung's Profile: http://www.excelforum.com/member.php...o&userid=31800
View this thread: http://www.excelforum.com/showthread...hreadid=515240




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com