brasqo
New Member
- Joined
- Jul 10, 2019
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
Hello,
Hopefully I can explain this without sounding like a dope =/
Quick background, I use the following TRIM() formula on a worksheet column on values that are all similar (IE: ABCDEFG Z307G- Z2CGK / Z307G.... These values could have different lengths, and the below formula seems to work seamlessly thus-far)
This subsequently Trims out the fat, and leaves the value I require (Z307G in the above example)...
I was hoping to create a macro that would perform this same task by Trimming and printing the new shorter value in the same column (In this example, Column B) as what was being trimmed (replacing the original longer string of data).
I'm not understanding how I'd be able to implement the above =TRIM() into a VBA macro...
I've looked at VBA.Trim and WorksheetFunction.Trim, but just cant wrap my head around how I'd be able to implement the complete formula that I know works.
If anyone can point me in the right direction it would be appreciated greatly.
Thank you all in advance
Hopefully I can explain this without sounding like a dope =/
Quick background, I use the following TRIM() formula on a worksheet column on values that are all similar (IE: ABCDEFG Z307G- Z2CGK / Z307G.... These values could have different lengths, and the below formula seems to work seamlessly thus-far)
VBA Code:
=TRIM(RIGHT(B2,FIND(" ",B2)-2))
This subsequently Trims out the fat, and leaves the value I require (Z307G in the above example)...
I was hoping to create a macro that would perform this same task by Trimming and printing the new shorter value in the same column (In this example, Column B) as what was being trimmed (replacing the original longer string of data).
I'm not understanding how I'd be able to implement the above =TRIM() into a VBA macro...
I've looked at VBA.Trim and WorksheetFunction.Trim, but just cant wrap my head around how I'd be able to implement the complete formula that I know works.
If anyone can point me in the right direction it would be appreciated greatly.
Thank you all in advance