Fix Custom Function Result Format Hi All, I have created a custom formula using
ID: 3571113 • Letter: F
Question
Fix Custom Function Result Format
Hi All,
I have created a custom formula using VBA to show the Username of the person editing a cell.
VBA Code:
Public Function UserName()
UserName = Environ$("UserName")
End Function
Unfortunately, the company username format is "jsmith" with 'j' being the first character of the person's first name and 'smith' being their last name but the spreadsheet requires that the format be "J. Smith". How do I go about ensuring that the username format matches the spreadsheet's requirements??
Thanks for help !
Explanation / Answer
Hi..
How about:
Public Function UserName()
varUserName = Environ$("UserName")
UserName = UCase(Left(varUserName, 1)) & ". " _
& UCase(Mid(varUserName, 2, 1)) _
& (Right(varUserName, Len(varUserName) - 2))
End Function
Hope this helps & answers your question
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.