Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VLOOKUP using a range variable

I have a worksheet into which I'm importing a userlist generated by
another application. This list contains user IDs that will determine
who can open the spreadsheet application.

As part of the workbook's OPEN event, the users must log in to the app.
I'm getting the user ID via an InputBox, and I want to verify that the
value is within column 1 of sheet 2.

VLOOKUP seems to cough, however, on the variable reference. This value
(the variable) will be different, since the app will run on a number of
servers with mirrored network layouts. So, when the sheet loads, the
userlist will shrink and grow over time.

I'd like to know how I can get this done. It doesn't really matter to
me if the procedure involves VLOOKUP or any other function- I just need
to be able to allow or deny access to the application. I'd appreciate
any push in the right direction.


Henry
DPM MEllon



*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VLOOKUP using a range variable

Private Sub Workbook_Open()

ID = Inputbox("Enter User ID")
res = Application.Match(ID,thisworkbook _
.Worksheets(1).Columns(1),0)
if not iserror(res) then
msgbox "Welcome " & ID
else
msgbox "Access is not authorized for you"
This workbook.Close SaveChanges:=False
End if
End Sub

--
Regards,
Tom Ogilvy


"Henry Hayden"
wrote in message ...
I have a worksheet into which I'm importing a userlist generated by
another application. This list contains user IDs that will determine
who can open the spreadsheet application.

As part of the workbook's OPEN event, the users must log in to the app.
I'm getting the user ID via an InputBox, and I want to verify that the
value is within column 1 of sheet 2.

VLOOKUP seems to cough, however, on the variable reference. This value
(the variable) will be different, since the app will run on a number of
servers with mirrored network layouts. So, when the sheet loads, the
userlist will shrink and grow over time.

I'd like to know how I can get this done. It doesn't really matter to
me if the procedure involves VLOOKUP or any other function- I just need
to be able to allow or deny access to the application. I'd appreciate
any push in the right direction.


Henry
DPM MEllon



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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VLOOKUP using a range variable

Thanks, Tom. I tried this very quickly at work earlier this afternoon
and fo the first time I didn't get a compile- or run-time error. Now I
have to look at the MATCH() function to see how it is applied. I tested
searching for a value that I could clearly see was in the list but it
was not found. I don't yet know what the return values should be. I'll
take a look tomorrow morning and see how it goes. Thanks again- it's
been a long day.


Henry


*** Sent via Developersdex http://www.developersdex.com ***
Reply
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
VLOOKUP variable range cell reference Ohp Excel Worksheet Functions 2 July 3rd 07 02:52 PM
Vlookup using variable path name for range value Jeff Lowenstein Excel Worksheet Functions 1 February 9th 06 01:13 AM
Macro to copy a specified range to a variable range SWT Excel Programming 4 October 21st 05 08:24 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"