To remove characters at the start of the input values, you can use VBA & Macros ** in Excel Office 365. With the help of Macros, you can easily achieve this task. In this article, we are going to learn the steps to **remove characters at the start using Macros (VBA) in Excel Office 365.
Steps to Remove Characters at the Start using Macros:
Follow the below instructions to delete characters at the start of the input values in the Excel worksheet.
- In the following image, you can see the input range from cell B2:B6. We are going to remove the first two characters of these input values.
- On the Developer Tab, select the Visual Basic option under the Code section.
- Then you need to copy and paste the code given below.
VBA code to remove characters using Macros
Sub RemoveCharactersAtTheStart()
Dim range As Range
Dim num As Integer
‘Get the characters
num = InputBox(“Input the number of characters to remove at the start”, “Num of characters”)
For Each range In Selection
‘Use Right to remove the first x characters
range = Right(range, Len(range) – num)
Next range
End Sub
- You need to save the code by selecting it. Then close the window.
- You have to open the sheet containing the data. On the Developer Tab, choose the Macros option in the Code section.
- You need to make sure that your macro is selected and click the Run button.
- Now, it will display a dialog box, where you want to enter the number of characters that you want to remove from the input range.
- As a result, you will see that the first two characters are removed from the input values as shown in the below screenshot.
Verdict:
In the above article, we have learned the clear-cut steps to remove characters at the start using Macros (VBA) in Excel Office 365. Give your worthwhile feedback in the below comment section. Thanks for visiting Geek Excel. Keep Learning!
Top comments (0)