Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Worksheets
If..The Statement to automatically format a name
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Ron Rosenfeld, post: 3847033"] On Sun, 8 Nov 2009 15:04:01 -0800, G. B. Needs Excel Help <G. B. Needs Excel You can do this with a User Defined Function. This function adds a dot "." after any single letter within your string. So, for example, it will handle names like H J Smith, J Smith. To enter this User Defined Function (UDF), <alt-F11> opens the Visual Basic Editor. Ensure your project is highlighted in the Project Explorer window. Then, from the top menu, select Insert/Module and paste the code below into the window that opens. To use this User Defined Function (UDF), enter a formula like =ReDot(A1) in some cell. ===================================== Option Explicit Function ReDot(s As String) Dim re As Object Set re = CreateObject("vbscript.regexp") With re .IgnoreCase = True .Global = True .Pattern = "\b([A-Z])(\s|$)" ReDot = .Replace(s, "$1. ") End With End Function ========================= --ron [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Worksheets
If..The Statement to automatically format a name
Top