Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Finding a string in a cell

I am using Excel 97, I have a column of data which needs separating I am
wanting to find each cell that contains in part of the cell the word
'investigating' then with each cell found move it to the next column to the
right.

I have tried the instr function but obviously doing something wrong!

Any help would be appreciated.

--
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Finding a string in a cell


For Each cell in Selection
If LCase(cell.Value) Like "*investigating*"
cell.Offset(0,1).Value = cell.Value
End If
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mark" wrote in message
...
I am using Excel 97, I have a column of data which needs separating I am
wanting to find each cell that contains in part of the cell the word
'investigating' then with each cell found move it to the next column to

the
right.

I have tried the instr function but obviously doing something wrong!

Any help would be appreciated.

--
Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Finding a string in a cell

Hi Mark,

Try something like:

'=================
Public Sub Tester001()
Dim rng As Range
Dim rCell As Range
Dim WB As Workbook
Dim SH As Worksheet
Const sStr As String = "investigating" '<<===== CHANGE

Set WB = ActiveWorkbook '<<===== CHANGE
Set SH = WB.Sheets("Sheet1") '<<===== CHANGE
Set rng = SH.Range("A1:A100") ' <<===== CHANGE

For Each rCell In rng.Cells
With rCell
If InStr(1, .Value, sStr, vbTextCompare) Then
rCell.Copy rCell(1, 2)
rCell.ClearContents
End If
End With
Next rCell
End Sub
'<<=================


---
Regards,
Norman



"Mark" wrote in message
...
I am using Excel 97, I have a column of data which needs separating I am
wanting to find each cell that contains in part of the cell the word
'investigating' then with each cell found move it to the next column to
the
right.

I have tried the instr function but obviously doing something wrong!

Any help would be appreciated.

--
Mark



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding a string in a cell

Dim rng as Range, cell as Range
With ActiveSheet
set rng = intersect(.columns(3),.UsedRange)
End with
set cell = .Find(what:="investigating",Lookat:=xlPart)
if not cell is nothing then
do
cell.offset(0,1).Value = cell.value
cell.clearcontents
set cell = rng.findnext(cell)
Loop while not cell is nothing
end if

--
Regards,
Tom Ogilvy


"Mark" wrote in message
...
I am using Excel 97, I have a column of data which needs separating I am
wanting to find each cell that contains in part of the cell the word
'investigating' then with each cell found move it to the next column to

the
right.

I have tried the instr function but obviously doing something wrong!

Any help would be appreciated.

--
Mark



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Finding a string in a cell

Mark, Apart from the other replies turn on the macro recorder and do a
Find from the Excel menu then look at the code, might help.

Mark wrote:
I am using Excel 97, I have a column of data which needs separating I am
wanting to find each cell that contains in part of the cell the word
'investigating' then with each cell found move it to the next column to the
right.

I have tried the instr function but obviously doing something wrong!

Any help would be appreciated.

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
Finding the cell with a specified string Don Kline[_2_] Excel Worksheet Functions 4 March 31st 09 04:19 AM
Finding the last cell to enter a string and/or a sum formula rojobrown Excel Worksheet Functions 5 October 3rd 06 09:36 PM
Finding a text string w/in a Cell ricxl Excel Discussion (Misc queries) 12 March 20th 06 03:47 AM
Finding a string within a cell value peacelittleone[_2_] Excel Programming 6 August 5th 05 09:17 PM
Finding a given string in a cell palie Excel Programming 4 December 8th 03 02:28 PM


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