Consulting

Results 1 to 9 of 9

Thread: Sleeper: Remove words

  1. #1

    Sleeper: Remove words

    in a cell I have "8.0 (Evaluation Mode)". How can i remove only "(Evaluation Mode)?

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    What is objectionable about "(Evaluation Mode)"?
    The fact that it is inside parenthesis, or that it is after the first left parenthesis?

    Perhaps
    =SUBSTITUTE(A1, "("&TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1,"(",")"),")",REPT(" ",255)),255,255))&")", "")
    or
    =TRIM(LEFT(SUBSTITUTE(A1,"(",REPT(" ",255)), 255))
    might work

  3. #3
    Mike,

    Can this done with VBA?

    The "(Evaluation Mode)" will be removed when the user enters a password.

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Yes it could.
    What result do you want from:
    "John Smith (marry mode) Dave(single friend) Cat"

    What code have you tried?

  5. #5
    Mike,

    the result i'm trying to achieve is to delete (Evaluation Mode) from 8.1 (Evaluation Mode) resulting in 8.1 remaining. The purpose for this is for display only.

  6. #6
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Would =SUBSTITUTE(A1, "(Evaluation Mode)", "") do the job?

  7. #7
    Yes it probably would, but that looks like a formula rather then vba? I would need to a vba to execute the change when the user enters a password.

  8. #8
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    If its that straight forward, you could record a macro of you Find&Replacing "(Evaluation Mode)" with "" and use that.

  9. #9
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    If you just want to replace a cell substring using VBA then

    Option Explicit
    Sub NoMoreEval()
        ActiveSheet.Cells(1, 1).Value = "Ver 8.1 (Evaluation Mode)"
    MsgBox ActiveSheet.Cells(1, 1).Value
    Call ActiveSheet.Cells(1, 1).Replace(" (Evaluation Mode)", vbNullString, xlPart)
        MsgBox ActiveSheet.Cells(1, 1).Value
    End Sub
    Paul

Posting Permissions

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