ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check whether text in a cell contains a string (https://www.excelbanter.com/excel-programming/393234-check-whether-text-cell-contains-string.html)

Colin Macleod

Check whether text in a cell contains a string
 
I want to copy selected rows from a database on one worksheet to another
worksheet. The criteria will be whether the text in column C (for example)
contains a string that is input by the user. So if cell c5 contains "Europe"
and the user has input "rope" (into a text box on a user form) then the
entire record on row 5 would be copied.

I know this can be done via AutoFilter then Custom then Contains - but this
is part of a VBA project so I need some VBA code to do this.

All help gratefully appreciated.

Colin Macleod


Wigi

Check whether text in a cell contains a string
 
Hi

you could go here

http://www.contextures.com/xlautofilter03.html#Copy

and adjust that general bit of code to suit.


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Colin Macleod" wrote:

I want to copy selected rows from a database on one worksheet to another
worksheet. The criteria will be whether the text in column C (for example)
contains a string that is input by the user. So if cell c5 contains "Europe"
and the user has input "rope" (into a text box on a user form) then the
entire record on row 5 would be copied.

I know this can be done via AutoFilter then Custom then Contains - but this
is part of a VBA project so I need some VBA code to do this.

All help gratefully appreciated.

Colin Macleod



All times are GMT +1. The time now is 04:23 PM.

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