Solve problems with splitting names in Excel. Works for “&” between initials or between first names. Check out my online courses www.easyexcelanswers.com/courses.html
All my courses include online support and a user manual
Let me teach you the VBA that I have learn in my five years of consulting
Let’s take the frustration out of user forms
Become an Affiliate and earn 25% on Course Sales
For more help visit my website www.easyexcelanswers.com or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Click for online Excel Consulting
I am able to provide online help on your computer at a reasonable rate.
I use a Blue condenser Microphone to record my videos, here is the link
Check out Crowdcast for creating your webinars
If you need to buy Office 2019 follow
I use Tube Buddy to help promote my videos
Check them out
Follow me on Facebook
TWEET THIS VIDEO
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.
code
Sub splitname()
Dim name As String
Dim fname As String
Dim lname As String
Dim intoPos As Integer
Dim x As Integer
Worksheets(“sheet1″).Select
x = 2
Do While Cells(x, 1) (does not equal)””
name = Sheet1.Cells(x, 1)
intPos = InStr(name, ” “) ‘ find the comma
fname = Mid(name, intPos + 1) ‘allow for comma and a space
lname = Left(name, intPos – 1)
Sheet1.Cells(x, 2) = lname
Sheet1.Cells(x, 3) = fname
x = x + 1
Loop
End Sub
Sub initials()
Dim r, c As Long
Dim erow As Long
Dim place As Long
Dim add, temp As String
Dim mystring As String
erow = Range(“A” & Rows.Count).End(xlUp).Row
r = 2
c = 3
For r = 2 To erow
fname = Sheet1.Cells(r, 2)
Sheet1.Cells(r, c).Select
‘looking for cells that start with &
If Left(ActiveCell.Value, 1) = “&” Then
mystring = ActiveCell.Value
‘look for the first space after the letter after the &
place = InStr(3, mystring, ” “)
‘ create a string to add to the first name
add = ” ” & Left(mystring, place)
‘adjust the lastname field
temp = Right(mystring, Len(mystring) – place)
ActiveCell.Value = temp
‘add the string to the first name
fname = fname & add
‘assign the new first name to the fist name field
Sheet1.Cells(r, 2) = fname
End If
Next r
End Sub
Watch more new videos about Excel Office | Synthesized by Mindovermetal English
Great
Oh that’s so clever! Thanks for sharing.