ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select and Move based upon keyword (https://www.excelbanter.com/excel-programming/322841-select-move-based-upon-keyword.html)

PJohnson

Select and Move based upon keyword
 
I am trying to find a way to select and move cell values based upon the
originating cell containing a keyword, like "School" or whatever. In the
following code, it only finds and moves cells that contain only the word
"School". What it I wanted to select and move cells that containted the
keyword "School", like "School of Business" or "Agriculture School".

I cannot find an object to handle this.

Any help appreciated.

Pete

================================
Select Case ActiveSheet.Cells(i, k).Value
Case ""
ActiveSheet.Cells(i, k).Select
Case "School"
If ActiveSheet.Cells(i, k + L).Value = "" Then
ActiveSheet.Cells(i, k).Select

.........



Nicholas B

Select and Move based upon keyword
 
Pete

Try the following

TestValu = CStr(ActiveCell.Value)
IF INSTR(UCASE(TestValu),"SCHOOL") 0 then ' word school is in the cell

ELSE

ENDIF

"PJohnson" wrote:

I am trying to find a way to select and move cell values based upon the
originating cell containing a keyword, like "School" or whatever. In the
following code, it only finds and moves cells that contain only the word
"School". What it I wanted to select and move cells that containted the
keyword "School", like "School of Business" or "Agriculture School".

I cannot find an object to handle this.

Any help appreciated.

Pete

================================
Select Case ActiveSheet.Cells(i, k).Value
Case ""
ActiveSheet.Cells(i, k).Select
Case "School"
If ActiveSheet.Cells(i, k + L).Value = "" Then
ActiveSheet.Cells(i, k).Select

.........





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

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