Want to quickly truncate the first number of characters of your choosing? Excel Macros can remove characters at the start of your selection of text!

Make sure your Excel has the Developer Tab enabled following this tutorial.

I explain how you can do this below step by step!

What does it do?

Removes the number of characters at the start as specified by the user

Copy Source Code:


Sub RemoveCharactersAtTheStart()

Dim range As Range
Dim num As Integer

'Get the characters to be removed from the user
num = InputBox("Input the number of characters to remove at the start", "Num of characters")

'Loop through all of the text
For Each range In Selection
'Use Right to remove the first x characters
range = Right(range, Len(range) - num)
Next range

End Sub

Final Result: 

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

Exercise Workbook:

YouTube video
Remove Characters at the Start Using Macros In Excel | MyExcelOnline

DOWNLOAD EXCEL WORKBOOK


This is the text that we want to modify. We want to remove the first 2 characters of these Part Numbers:

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

STEP 1: Go to Developer > Code > Visual Basic

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

 

STEP 2: Paste in your code and Select Save. Close the window afterwards.

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

 

STEP 3: Let us test it out!

Open the sheet containing the data. Go to Developer > Code > Macros

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

 

Make sure your part numbers and macro are selected. Click Run.

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

We want to remove the first 2 characters. Type in 2 and Click OK.

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

With just one click, the first 2 characters are now all removed!

Remove Characters at the Start Using Macros In Excel | MyExcelOnline

 

How to Remove Characters at the Start Using Macros In Excel

 

101 Macros Book

HELPFUL RESOURCES:

JOIN OUR FREE EXCEL COURSES BELOW
Click here to access these FREE Excel courses!

 

If you like this Excel tip, please share itEmail this to someone

email

Pin on Pinterest

Pinterest

Share on Facebook

Facebook

Tweet about this on Twitter

Twitter

Share on LinkedIn

Linkedin