I want to write a macro by which I can search a value 'DataA' in my excel sheet and replace it by value 'DataB'.
I want to write a macro by which I can search a value 'DataA' in my excel sheet and replace it by value 'DataB'.
Hi Reena,
This is freshly recorded
Sub Replace()
Cells.Replace What:="DataA", Replacement:="DataB",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
Regards,
Bondi
Or, in fact, if you don't actually have a particular need for a macro to do
it then why not select the Edit > Find... menu item to bring up the Find and
Replace dialogue. I'm convinced that you've seen it a million times before,
but you may still be surprised over how feature-rich it actually is (e.g.,
turn on the Advanced Mode by pressing the Options... button, and why not
check out the Format search options as well).
Not everything needs to be done programmatically :o) But if you want to,
then by recording your actions as a macro naturally helps a lot while trying
to figure out exactly what Excel objects to manipulate, and what params to
use.
Good luck Reena,
/MP
"Bondi" wrote:
> Hi Reena,
>
> This is freshly recorded
>
> Sub Replace()
> Cells.Replace What:="DataA", Replacement:="DataB",
> LookAt:=xlPart, _
> SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
> ReplaceFormat:=False
> End Sub
>
> Regards,
> Bondi
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks