Trim function on the same cell in multiple sheets
Results 1 to 3 of 3

Thread: Trim function on the same cell in multiple sheets
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2019
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Trim function on the same cell in multiple sheets

    Hi everyone,

    Hoping someone could point me in the right direction.

    I have a worksheet with multiple sheets that are all identical in layout (an export from another program)

    I need to trim one cell (F12) in each of these sheets.
    I've used the following formula on a cell to have it trim correctly and apply the trimmed output to a different cell (trimmed Cell A1, and put the result in B1 for example).. :
    Code:
    TRIM(RIGHT(A1,FIND(" ", A1)+1))
    But in this case, I need the trimming and application to to occur on the same cell.

    IE: I need "Hello HDC05- Hxxxx / HDC00" in cell F12 to become "HDC00" in the same F12 cell.
    Each sheet has a different value in F12, but in the same format as the example above.

    Any direction in figuring this out would be appreciated.

    Thank you!

  2. #2
    Board Regular Aryatect's Avatar
    Join Date
    Jun 2019
    Location
    Chicago, USA
    Posts
    301
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Trim function on the same cell in multiple sheets

    Hi,

    You can select all the tabs and where you need to apply the formula and enter the formula in any one tab in cell F12 and it will be copied in all tabs.
    Thanks!

    - forum use guidelines, forum rules and terms of use
    - Try searching for your answer first, see how
    - Read the FAQs
    - List of BB codes

  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,562
    Post Thanks / Like
    Mentioned
    444 Post(s)
    Tagged
    45 Thread(s)

    Default Re: Trim function on the same cell in multiple sheets

    How about
    Code:
    Sub brasqo()
       Dim Ws As Worksheet
       
       For Each Ws In Worksheets
          With Ws.Range("F12")
             .Value = Split(.Value)(UBound(Split(.Value)))
          End With
       Next Ws
    End Sub
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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