LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default parsing full names in to 3 columns

Okay, sorry for all the confusion. Here's the procedure we talked
about yesterday revised so that it will work whether or not there are
any blank rows. I've tested it using the data you originally supplied
and it works fine without errors. Just remember to set your range
reference to whatever you have. I've commented the line in the code
where you need to do this.

Sub FirstToLast()

Dim lkforComma As Integer
Dim lkforSpace As Integer
Dim fName, mName, lName As String
Dim myRange As Range
Dim myCell As Range

Set myRange = Range("A1:A9") 'set the range for whateve you
need

For Each myCell In myRange
If myCell < "" Then 'blank cells will be ignored

Set nextCell = myCell.Offset(1, 0)
Set firstName = myCell.Offset(0, 1)
Set middleName = myCell.Offset(0, 2)
Set lastName = myCell.Offset(0, 3)

lkforComma = InStr(myCell, ",")
lName = Left(myCell, lkforComma - 1)
fName = Mid(myCell, lkforComma + 2)
lkforSpace = InStr(fName, Chr(32))
mName = Mid(fName, lkforSpace + 1)
fName = Mid(fName, 1, lkforSpace - 1)
firstName.Value = fName
middleName.Value = mName
lastName.Value = lName

End If
Set myCell = nextCell
Next myCell

MsgBox "File Done"

End Sub



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parsing a full name out into Last, First, Middle Craig Excel Worksheet Functions 2 July 29th 09 12:57 AM
Formulas for Parsing Full names jonefer Excel Worksheet Functions 3 February 14th 06 06:28 AM
how do I find names in a workbook full of names aj Excel Discussion (Misc queries) 1 January 19th 06 09:01 PM
TypeLib Information Problem? Pass a Function's parameter names as string for parsing? Ali G Excel Programming 1 December 3rd 04 07:02 PM
Parsing Full Names of varying lenths and parts Dan Excel Programming 1 October 24th 03 06:26 PM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"