Hey all,
I'm working with a large macro, and part of the macro is designed to filter col M for "O" then look into column E and modify the data entered in there. Basically, the data in Col E contains several various numbers, some of which have a hyphen and a subsequent number (101-2, 102-6). I wanted to use the following macro to remove the hyphen and any numbers after the hyphen (102-6 becomes 102). I thought that the following formula would be effective:
'Sort OP in data file to remove -2 from E
Workbooks("260 " & CM).Activate
ActiveSheet.UsedRange.AutoFilter Field:=13, Criteria1:="O"
Columns("E").Replace What:="-?", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
ActiveSheet.UsedRange.AutoFilter Field:=13
However, when I use it, it seems to be removing data from other columns, such as H, I, & J. Is there something I am doing wrong that is causing the formula to effect other columns?
I'm working with a large macro, and part of the macro is designed to filter col M for "O" then look into column E and modify the data entered in there. Basically, the data in Col E contains several various numbers, some of which have a hyphen and a subsequent number (101-2, 102-6). I wanted to use the following macro to remove the hyphen and any numbers after the hyphen (102-6 becomes 102). I thought that the following formula would be effective:
'Sort OP in data file to remove -2 from E
Workbooks("260 " & CM).Activate
ActiveSheet.UsedRange.AutoFilter Field:=13, Criteria1:="O"
Columns("E").Replace What:="-?", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
ActiveSheet.UsedRange.AutoFilter Field:=13
However, when I use it, it seems to be removing data from other columns, such as H, I, & J. Is there something I am doing wrong that is causing the formula to effect other columns?