Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2008, 11:06 AM
Registered User
 
Join Date: Jun 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Function Procedure

Suppose you have a list like this:
Di Ruppo Elio
De Haene Jean-Luc
Van de Velde Annemie
Nagase Yoshi
del Valle Saavedra Antonio

First names are in bold, just for your information, not in the real file

I wrote two separate function procedures to get the last name and the first name.

Code:
Dim PosSpace As Byte

Function LastName(FullName As String) As String
PosSpace = InStrRev(FullName, " ")
LastName = Left(FullName, PosSpace - 1)
End Function

Function FirstName(FullName As String) As String
PosSpace = InStrRev(FullName, " ")
FirstName = Right(FullName, Len(FullName) - PosSpace)
End Function
I'm wondering wether you can create a single function procedure returning 2 results, in this case the last and the firstname, in other words, an array function returning 2 results when you select 2 cells and press CTRL-SHIFT-ENTER?


Renée





Similar Threads
Thread Thread Starter Forum Replies Last Post
Function used in procedure mikedeepak SQL Server 2000 3 February 13th, 2008 05:23 AM
Procedure or function has too many arguments Raby VB Databases Basics 6 November 16th, 2007 11:38 AM
Function and Procedure code_lover Oracle 2 July 24th, 2007 07:05 AM
Procedure or function STOREDPROC has too man rit01 ASP.NET 2.0 Basics 4 January 25th, 2006 09:51 AM
Analytical function and stored procedure akmhasan Oracle 2 November 14th, 2003 01:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.