Trim function on the same cell in multiple sheets

brasqo

New Member
Joined
Jul 10, 2019
Messages
9
Office Version
  1. 365
Platform
  1. Windows
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!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top