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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

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,864
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,106,545
Messages
5,511,962
Members
408,871
Latest member
Usman21

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top