VBA: Remove last character from a string

strorg

Board Regular
Joined
Mar 27, 2002
Messages
112
How do I remove the last character from a string in VBA?

Thanks...Tom
 
Similar questions

I have a similar issue but at the end of not all but most data I have question marks. What kind of macro would I run just to remove the question marks and nothing else?? I am not great at VBS. Thanks so much!
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Could do it with Find/Replace.

Enter ~? in the Find box and leave the Replace box blank.

A macro can be obtained via the macro recorder.
 
Upvote 0
I wonder how to get the first characteres ?
I've :

12346-@-2
2345677-@-45
345434-@-34

and I want only the numeric values before the '-@-'

Code:
frn = "145334-@-"
        frn = Mid(frn, 1, Len(frn) - InStr(1, frn, "@"))
        frn = Mid(frn, 1, Len(frn) - 2)
        frn = CInt(frn)

this code doesn't seems to work
 
Upvote 0
Alternatively :-

Code:
r = Val("1232123-@-23")

Or a worksheet formula :-

=LEFT(A1,FIND("-",A1)-1)
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,076
Members
449,094
Latest member
mystic19

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