shekhu
05-31-2011, 05:46 AM
Hi,
I am new to excel macros and I am trying to use the following code.
The issue I have is with replace part. When I put in "Client Name" I want that to be replaced by "Client NameNextCellAddressNextCellemail
What I am getting is, everything in the same cell itself.
If anybody could help me out, it would be great.
Thanks
Sub FindAndReplace()
'
Selection.Replace What:="Petition #: ", Replacement:="PN", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Email: ", Replacement:="E", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Fax : ", Replacement:="F", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Debtor disposition:**", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Client Name", Replacement:="Client Name^tAddress^temail", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="ST", Replacement:="STREET", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="STS", Replacement:="STREETS", LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=True
End Sub
I am new to excel macros and I am trying to use the following code.
The issue I have is with replace part. When I put in "Client Name" I want that to be replaced by "Client NameNextCellAddressNextCellemail
What I am getting is, everything in the same cell itself.
If anybody could help me out, it would be great.
Thanks
Sub FindAndReplace()
'
Selection.Replace What:="Petition #: ", Replacement:="PN", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Email: ", Replacement:="E", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Fax : ", Replacement:="F", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Debtor disposition:**", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="Client Name", Replacement:="Client Name^tAddress^temail", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="ST", Replacement:="STREET", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True
Selection.Replace What:="STS", Replacement:="STREETS", LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=True
End Sub