View Single Post
 
Old 03-21-2019, 03:37 AM
thomas47 thomas47 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Mar 2014
Location: France
Posts: 6
thomas47 is on a distinguished road
Default Excel VBA function range.replace

Hi everybody,

I have a small issue with the fonction Range.Replace.
I have the following code:

Columns("F:H").Select
Selection.Replace What:="Dec", Replacement:="Dez", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True
Selection.Replace What:="Oct", Replacement:="Okt", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True
Selection.Replace What:="May", Replacement:="Mai", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True
Selection.Replace What:="Mar", Replacement:="Mär", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True
Selection.Replace What:="-", Replacement:=".", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=True

Everything works well except when I replace "-" with "."
all "-" are replaced by a "." in the complete sheet instead of only in the range.
I tried as well to replace Columns("F:H").Select by Range(Cells(2, 6), Cells(Last_Row_Import, 8)).Select but still the same.

did someone already face this issue?

thank you for your support.
Reply With Quote