![]() |
hello, very new to VBA, (?) silly question coming.....
Hi there, and thanks for reading this!
I am new to VBA and have an excel spreadsheet with a form in it that I would like to use with a drop-down list to enable people to login to the spreadsheet. I have managed to make the form appear when the workbook is loaded (I told you I'm very new to VBA!) and now have a form that shows a drop-down box and a text entry field. I would like to be able to use the drop-down box to lookup a list from a spreadsheet (preferably an external sheet but it can be internal to the worksheet if this is not possible) to select a list of user names... This is my first hurdle... After that I am hoping that the user will enter a password that will also use some sort of lookup function to the same worksheet to deternine whether the password is correct or not, I am looking to loop this for a number of attempts (3 for example) so that if they do not enter the correct password they cannot enter the worksheet. The overall hope is that once they have entered their username and password they will be able to access different levels of the worksheet, so if they only have 'Low' user accesibility then they will only see certain sheets, if they have admin rights then they will see the whole sheet etc... I hope you see where I am heading, for the moment tho I would be grateful for any advice including how to lookup a list of names in a worksheet to populate my drop-down box! Thanks again for reading this, its my first post! Rachie :D p.s I am using Excel 2003! |
hello, very new to VBA, (?) silly question coming.....
Rachie
Start with something like this: For Each c In Worksheets("Vendors").Range("A:A") If c.Value < "" Then InfoCard.VendorCombo.AddItem c.Value Next InfoCard is the name of the form VendorCombo is the name of the ComboBox .... so this snippet loads up a ComboBox with all the vales in a range in Column A You COULD change the .Range("A:A") to .Range("UserNames") and define your list of users in a range called UserNames Hope this gets you started. Greg Rachie wrote: Hi there, and thanks for reading this! I am new to VBA and have an excel spreadsheet with a form in it that I would like to use with a drop-down list to enable people to login to the spreadsheet. I have managed to make the form appear when the workbook is loaded (I told you I'm very new to VBA!) and now have a form that shows a drop-down box and a text entry field. I would like to be able to use the drop-down box to lookup a list from a spreadsheet (preferably an external sheet but it can be internal to the worksheet if this is not possible) to select a list of user names... This is my first hurdle... After that I am hoping that the user will enter a password that will also use some sort of lookup function to the same worksheet to deternine whether the password is correct or not, I am looking to loop this for a number of attempts (3 for example) so that if they do not enter the correct password they cannot enter the worksheet. The overall hope is that once they have entered their username and password they will be able to access different levels of the worksheet, so if they only have 'Low' user accesibility then they will only see certain sheets, if they have admin rights then they will see the whole sheet etc... I hope you see where I am heading, for the moment tho I would be grateful for any advice including how to lookup a list of names in a worksheet to populate my drop-down box! Thanks again for reading this, its my first post! Rachie :D p.s I am using Excel 2003! |
All times are GMT +1. The time now is 06:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com