Hello people,
I am trying to complete my work on one macro and is stucked somewhere in between.
My problem is that if a cell contain certain value ( oranges word in big paragraph in the cell in excel), i need to replace it with the value given in the another cell ( in the other cell, the value is apples). My code is given below, i am getting error. Please someone help.
Example if the cell have the below sentence
I have 5 oranges ---> then it should be changed into
I have 5 apples -----> this should be the final sentence
Thanks for help in the advance
I am trying to complete my work on one macro and is stucked somewhere in between.
My problem is that if a cell contain certain value ( oranges word in big paragraph in the cell in excel), i need to replace it with the value given in the another cell ( in the other cell, the value is apples). My code is given below, i am getting error. Please someone help.
Example if the cell have the below sentence
I have 5 oranges ---> then it should be changed into
I have 5 apples -----> this should be the final sentence
Thanks for help in the advance
Code:
Sub finalemailing()
Dim clltext1 As String
Dim clltext As String
Dim xxwi As String
xxwi = "xxwi"
clltext = ThisWorkbook.Sheets("Email Template").Range("C7").Value
clltext1 = ThisWorkbook.Sheets("Email Template").Range("C5").Value
If InStr(1, clltext, "xxwi") Then
clltext.Replace What:="xxwi", Replacement:=clltext1, LookAt:=xlPart, MatchCase:=False
End If
End sub