Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to check if a cell is part of a series of cells (not a neat ra | Excel Programming | |||
How to check if a cell is part of a series of cells (not a neat ra | Excel Programming | |||
How do i check if the current cell is part of a range ? | Excel Programming | |||
need macro to check part# and sum | Excel Worksheet Functions | |||
Check if (part of) a row is blank. | Excel Programming |