ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find macro (https://www.excelbanter.com/excel-programming/362862-find-macro.html)

XCESIV[_20_]

find macro
 

I want to setup a macro that searches for a part of a cell and then
brings back the cell/s relevant to the search.

similar to a v lookup but i dont want to have it on the sheet. I want
it only as a question box

There also may be various accounts on the list with similar
Descriptions
I would like the display box to display all accounts with the matching
string

EG
account No. 85000 - "WAGES - STAFF"
account No. 85500 - "WAGES - CONTRACTS"
account No. 85200 - "SUPERANNUATION"


Search "Wages"

Results
85000 - WAGES - STAFF
85500 - WAGES - CONTRACTS


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile: http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=546937


Bob Phillips

find macro
 
Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim stmp

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If LCase(Cells(i, "A").Value) Like "*wages*" Then
stmp = stmp & Cells(i, "A").Value & vbNewLine
End If
Next i

MsgBox stmp

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"XCESIV" wrote in
message ...

I want to setup a macro that searches for a part of a cell and then
brings back the cell/s relevant to the search.

similar to a v lookup but i dont want to have it on the sheet. I want
it only as a question box

There also may be various accounts on the list with similar
Descriptions
I would like the display box to display all accounts with the matching
string

EG
account No. 85000 - "WAGES - STAFF"
account No. 85500 - "WAGES - CONTRACTS"
account No. 85200 - "SUPERANNUATION"


Search "Wages"

Results
85000 - WAGES - STAFF
85500 - WAGES - CONTRACTS


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile:

http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=546937





All times are GMT +1. The time now is 10:06 PM.

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