Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Okay, I have established that this run-time error only occurs when the string
does not occur in any cells. How do I avoid this, because I want to run the macro on every worksheet i import, but it can't run-time error just because there is no "BCI" found in column B "dmoney" wrote: u need to make sure that something is selected before running this code for example Columns("B:B").Select "Derek Johansen" wrote: Mr. Money, I am getting a run-time error with this code: Selection.Find(What:="hat", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate It says "Object variable or With block variable not set." Any suggestions? "dmoney" wrote: ActiveCell.Offset(0, 8).Value = "enjoy" "Derek Johansen" wrote: I would like to check to see if a cell contains a certain string within the whole cell. For example, if column B has a lot of data, and one of the entries is "The cat in the hat" I would like a macro to search column B for the word hat. I don't care what happens when it finds it at the moment, as I believe i can establish that myself, I just need a command to search within a cell for a certain word. I've tried using the InStr command a bit, but to no avail! Any help would be much appreciated! Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Searching alfanumaric cell contents and returning with a numaric v | Excel Discussion (Misc queries) | |||
Searching a cells contents? | Excel Worksheet Functions | |||
Searching in another workbook for a string and returning with the contents of the cell next to it. | Excel Worksheet Functions | |||
Searching through the contents of a Folder of text files | Excel Programming | |||
Data searching based on cell contents using VBa | Excel Programming |