Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple Substitution (03)

    Is it possible to have multiple substitutions in one line of code?

    Example:
    ActiveCell.Offset(0, 1) = af.Substitute(ActiveCell, "AM" Or "EU", "") Something like this.

    Thanks,
    John

  2. #2
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Substitution (03)

    After playing around, the best I could come up with is this:

    af.Substitute(af.Substitute(ActiveCell, "AM", ""), "EU", "")

    John

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multiple Substitution (03)

    In VBA code, you can use the Replace function instead of the Substitute worksheet function
    <code>
    ActiveCell.Offset(0, 1) = Replace(Replace(ActiveCell, "AM", ""), "EU", "")
    </code>
    Replace is a general VBA function that has been introduced in Office 2000.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •