Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Check part of cell for data

I need to check the cells in a column to see if any of the cells contain
certain data. For example:

Apple Pie
Apple and Berry Cobbler
Berry Jam
Apple Jam

I would need to be able to run the macro to check if the cell contained
Berry to then list each cell that fit the criteria. I've got my Loop to run
through the column and transfer the data to another column but need to code
for checking within each cell. Any help would be great. Thanks!
--
Mike
M2K Computer Consulting
www.m2kcomputers.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check part of cell for data


Try something along the line of:

Sub berry()
Dim strToFind
strToFind = "berry"
For r = 1 To 4
If InStr(1, Cells(r, 1), strToFind, vbTextCompare) 0 Then Cells(r, 3)
= Cells(r, 1)
Next r
End Sub

This assumes the list is in column 1 and the cell contents needs
copying to column 3.


Mike K. Wrote:
I need to check the cells in a column to see if any of the cells
contain
certain data. For example:

Apple Pie
Apple and Berry Cobbler
Berry Jam
Apple Jam

I would need to be able to run the macro to check if the cell
contained
Berry to then list each cell that fit the criteria. I've got my Loop to
run
through the column and transfer the data to another column but need to
code
for checking within each cell. Any help would be great. Thanks!
--
Mike
M2K Computer Consulting
www.m2kcomputers.com



--
ben77
------------------------------------------------------------------------
ben77's Profile: http://www.excelforum.com/member.php...o&userid=35602
View this thread: http://www.excelforum.com/showthread...hreadid=554318

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
How to check if a cell is part of a series of cells (not a neat ra JeKaRe Excel Programming 3 June 21st 06 07:26 PM
How to check if a cell is part of a series of cells (not a neat ra tdw Excel Programming 0 June 21st 06 05:34 PM
How do i check if the current cell is part of a range ? Luc Excel Programming 2 April 28th 06 07:15 PM
need macro to check part# and sum jg53 Excel Worksheet Functions 8 April 13th 06 04:29 PM
Check if (part of) a row is blank. mika.[_2_] Excel Programming 5 November 11th 03 10:16 PM


All times are GMT +1. The time now is 07:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"