frankdethier
New Member
- Joined
- Mar 1, 2021
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
hi
I need to replace all words in an excel tab ''change initiative'' by a customer specific word, e.g. how the initiative is called at the customers. For example ''BOOST''. But ''Boost'' is not fixed and is a value coming from a survey, so I cannot hard code it in VBA. Is there a way to have VBA code referring to value in particular cell, like B5? Now BOOST is copied into cell B5.
I started with this code, but that obviously doesn't work cause it's replacing everywhere change initiative by ''B2'' --> how can I replace it with the value of cell B2?
Sub TestReplace()
Sheets("Sheet1").UsedRange.Replace What:="change initiative", Replacement:="B2"
End Sub
I need to replace all words in an excel tab ''change initiative'' by a customer specific word, e.g. how the initiative is called at the customers. For example ''BOOST''. But ''Boost'' is not fixed and is a value coming from a survey, so I cannot hard code it in VBA. Is there a way to have VBA code referring to value in particular cell, like B5? Now BOOST is copied into cell B5.
I started with this code, but that obviously doesn't work cause it's replacing everywhere change initiative by ''B2'' --> how can I replace it with the value of cell B2?
Sub TestReplace()
Sheets("Sheet1").UsedRange.Replace What:="change initiative", Replacement:="B2"
End Sub