Trim function on the same cell in multiple sheets

brasqo

New Member
Joined
Jul 10, 2019
Messages
1
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!
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Aryatect

Active Member
Joined
Jun 17, 2019
Messages
308
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
44,466
Office Version
365
Platform
Windows
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,105,855
Messages
5,507,733
Members
408,647
Latest member
Nicho la zido

This Week's Hot Topics

Top