how can i resovlve the follwing issue in VBA
if string contains "SeachText" replace whole string.
ex.
input: "Test_1_The_Text_SeachString_Sth"
input: "Test_2_The_Text_SeachString_Sth"
look for: "SeachrString"
replace with "New_Text"
so after execute the code the
"Test_1_Of_The_Text_SeachString_Sth"
will become "New_Text"
as well as:
"Test_2_Of_The_Text_SeachString_Sth"
will become "New_Text"
Use Instr function like this:
ip1= "Test_1_The_Text_SeachString_Sth"
lookfor="SeachString"
If instr(ip1,lookfor)>0 then
ip1= "newtext"
End if
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.