ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find criteria and return name with VB (https://www.excelbanter.com/excel-programming/338693-find-criteria-return-name-vbulletin.html)

Tempy

Find criteria and return name with VB
 
Good day all, i got some code from this site to get the users name. It
works great, however we log in using a number e.g. QT00572, which it
returns. What i now need to do is get the users name, i have a sheet
called "names" in the file Recon_Master.xls file. When i open this file
i want the code to greet the person by name, so i must look up his name
by using his number to find the name.The visable sheet is not "Names"
sheet and i do not want to display it either.
Could somebody please give some help with this.

Thanks in advance,

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Bob Phillips[_6_]

Find criteria and return name with VB
 

Dim sLogin As String
Dim sname
sLogin = Environ("UserName")
sname = Application.Index(Worksheets("Names").Range("B:B") , _
Application.Match(sLogin, Worksheets("Names").Range("A:A"), 0))
If Not IsError(sname) Then
MsgBox sname
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Tempy" wrote in message
...
Good day all, i got some code from this site to get the users name. It
works great, however we log in using a number e.g. QT00572, which it
returns. What i now need to do is get the users name, i have a sheet
called "names" in the file Recon_Master.xls file. When i open this file
i want the code to greet the person by name, so i must look up his name
by using his number to find the name.The visable sheet is not "Names"
sheet and i do not want to display it either.
Could somebody please give some help with this.

Thanks in advance,

Tempy

*** Sent via Developersdex http://www.developersdex.com ***




Tempy

Find criteria and return name with VB
 
Thanks Bob,

Bob are you in the UK ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Bob Phillips[_6_]

Find criteria and return name with VB
 
Yes I am, on the South Coast.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Tempy" wrote in message
...
Thanks Bob,

Bob are you in the UK ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 03:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com