Hello good people of Mr Excel. I need to find a specific word in a string, when found, copy the RESULT of a formula (in a different cell) and paste it to a cell in the same row as where the word was found.
The code I have managed to put together so far, finds the word “substituted” and inserts the values I want, but I need it to return the result of a formula. E.g. Max(“sheet1!D2:D99”)
code<>
Sub CheckIfRangeOfCellsContainsSpecificText_vba()
Sheets("Cabinets").Select
'excel, if range of cells contains specific text vba
Set Rng = Range("I2:I1500") ' User can edit this
specificText = "substituted" ' User can edit this
For Each cell In Rng.Cells
If UCase(cell.Value) Like "*" & UCase(specificText) & "*" Then
cell.Offset(0, -5) = "600"
cell.Offset(0, -4) = "16"
' Else
' cell.Offset(0, 2) = " "
End If
Next
Calculate
I will be ever so grateful for your help.
kind regards
Andy
The code I have managed to put together so far, finds the word “substituted” and inserts the values I want, but I need it to return the result of a formula. E.g. Max(“sheet1!D2:D99”)
code<>
Sub CheckIfRangeOfCellsContainsSpecificText_vba()
Sheets("Cabinets").Select
'excel, if range of cells contains specific text vba
Set Rng = Range("I2:I1500") ' User can edit this
specificText = "substituted" ' User can edit this
For Each cell In Rng.Cells
If UCase(cell.Value) Like "*" & UCase(specificText) & "*" Then
cell.Offset(0, -5) = "600"
cell.Offset(0, -4) = "16"
' Else
' cell.Offset(0, 2) = " "
End If
Next
Calculate
I will be ever so grateful for your help.
kind regards
Andy