POOR THREAD TITLE Please read THIS PAGE IN FULL
I am trying to write a function that finds and breaks a cell about the first space.
and also...VB:Function Firstname(name) Dim Space As Integer Set Space = .Find(" ", name) Firstname = Left(name, Space) End Function
VB:Function Firstname(name) firstname = left(name,find(" ",name)-1)) End Function
What am i doing wrong?
See the new thread title which is along the lines of what you agreed to. Hvae you read the rules?
Ok, sweet. Get ya
what am I looking for thats going to make that work in VBA? I want my staff/users to simply right a formula sort of along the lines:
I get all the left, right etc, but am not sure how to find the first space.
TryVB:Function FirstName(Cell_Name As Range) As String Dim lSpace As Long Dim strName As String strName = Trim(Cell_Name) lSpace = InStr(1, strName, " ", vbTextCompare) FirstName = Trim(Left(strName, lSpace)) End Function
Thanks a whole bunch!
Made the right argument now.
VB:Function LastName(Cell_Name As Range) As String Dim lSpace As Long Dim strName As String strName = Trim(Cell_Name) lSpace = InStr(1, strName, " ", vbTextCompare) LastName = Trim(Right(strName, Len(strName) - lSpace)) End Function
There are currently 5 users browsing this thread. (0 members and 5 guests)