LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Username generator function

I'm trying to create an automatic username generator function. This is
what I have so far:

Function createusername(konto, art, adgang) As String

If UCase(adgang) = UCase("ja") Then

If UCase(art) = UCase("kunde") Then
usnam = konto & 1
ElseIf UCase(art) = UCase("agent") Then
usnam = konto & "_AG" & 1
End If
End If

createusername = usnam

End Function

If
Konto = "MM", Art = "Kunde" and adgang = "ja" then the userid will
created as MM1

If
Konto = "SS", Art = "agent" and adgang = "ja" then the userid will
created as SS_AG1

Now to my question. If userid MM1 alrready exist in column where the
function is used, the next useridf for same "konto" and "art" should
be MM2, next MM3 and so on. Same goes for art = "agent", like

SS_AG1
SS_AG2 an so on

How do I get the function to look above so to speak, compare "konto"
and "art" and then add 1 to the highest number used?

Jan



 
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
Change username via VBA in Saveas function Lp12 Excel Programming 2 September 7th 09 03:02 PM
environ username vs. application username jatman Excel Programming 4 May 28th 09 08:40 AM
What is the function for system to capture the username Dave VB logic for excel Excel Discussion (Misc queries) 4 March 7th 09 07:33 AM
UserName Function: Not Working ryguy7272 Excel Programming 6 November 21st 07 02:00 PM
Function to display username/networkname Hendrik.Kleine[_2_] Excel Programming 4 August 17th 07 02:28 PM


All times are GMT +1. The time now is 06:09 PM.

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"