Here's an example how replace data using excel vba macro code. This example will replace all cell value that contain word "micro excel" to "macro excel" in active sheet.
Sub ReplaceAllData()
Cells.Replace _
What:="micro excel", Replacement:="macro excel", _
LookAt:=xlWhole, MatchCase:=False
End Sub
If you to make the search case sensitive you can change the MatchCase property to true. And also if you want to replace data that contain part of the searched data you can change the LookAt property to xlPart.
Related posts:
- Find A Particular Text Within Ranges And Return Its Row Position
- Excel VBA Macro Examples: Function Procedure
- Excel VBA Macro Examples: Sub Procedure
- Excel VBA Macro Tutorial: Range Objects
- Excel VBA Macro Tutorial: Controlling Execution
If you like posts in this blog, you can to support me :)
How can I ask excel to replace text Jul17 to Aug17 and leave the cell format as text. My Cell.Replace is changing the cell format from text to Custom "d-mmm". Instead of the result being Aug17 it is changing it to 17-Aug
ReplyDelete