I want a macro to look in column A for the word Timer. It can be any case and the word timer could be in a sentence. Once it is found I want to set the cell where it is found so I can copy that cell.
I want a macro to look in column A for the word Timer. It can be any case and the word timer could be in a sentence. Once it is found I want to set the cell where it is found so I can copy that cell.
I have the below which now finds the word I want. However, the formula I am then trying to insert - it actually uses the word Found instead of the range where it is actually found. Any help with that bit?
Sub NextPart() With Sheets("Macro") Dim FindWord As String, Found As Range FindWord = "Time " Set Found = Sheets("Macro").Columns("A:A").Find(What:=FindWord, _ LookIn:=xlValues, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) If Not Found Is Nothing Then Found.Select Else MsgBox "No match found." End If End With With Sheets("Macro") Found.Offset(0, 1).Formula = "=MID(Found,SEARCH(""Time"",Found)+5,8)" End With End Sub
simply
Sub NextPart() Dim FindWord As String, Found As Range FindWord = "Time " Set Found = Sheets("Macro").Columns("A:A").Find(What:=FindWord, _ LookIn:=xlValues, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) If Not Found Is Nothing Then Found.Offset(0, 1).FormulaR1C1 = "=MID(RC[-1],SEARCH(""Time"",RC[-1])+5,8)" Else MsgBox "No match found." End If End Sub
Josie
if at first you don't succeed try doing it the way your wife told you to
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks