Macro to remove remainder of string upon a condition

Hello,

I need a Macro to remove the remainder of a string after a "-" is located in the string. For example if the string is 1528-9, I want to change it to 1528 removing the "-9". The strings i'm looking at vary in length (from 4 to 10 characters) and the "-" can fall anywhere after the 3rd character.

Please assist if you can.

Comments

  • no need to reply, I see that by using find and replce to replace '-*' works. i.e.

    Range("?:?").Select
    Selection.Replace What:="-*", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion