VBA trim data with space not from spacebar

FryGirl

Well-known Member
Joined
Nov 11, 2008
Messages
1,360
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a two full columns of data that I need to trim. I can see the extra space at the end, but it's not a simple space from the spacebar. This data is downloaded from an Oracle database which as the source, I have no control over.

I used =CODE(RIGHT(V2)) to see what the space is and I get the value of 9. Is this the right way to determine what the character and the end is?

Here is what the data looks like.

BMOEAE
BMOEA0
BMOEAC

How can I use VBA to trim column V and column Z in one shot?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try
Code:
Sub FryGirl()
Range("V:V,Z:Z").Replace Chr(9), "", xlPart, , , , False, False
End Sub
 
Upvote 0
Are there always 6 characters then the Oracle character, whatever it is?

Why not just use LEFT to take the left-most 6 or use SUBSTITUTE to change that code to whatever else you wan it to be?
 
Upvote 0
@Fluff, Thank you that works great.

@ Kweaver, column z is 8 characters, but Fluff's code did it. Thanks.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,953
Members
448,535
Latest member
alrossman

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