MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Cell search & match and grab and compare from another column

  Asked By: Grant    Date: Jan 09    Category: MS Office    Views: 1478

I have a 2 part question

Firstly I have a workbook which has the following headings

Username Logon Fitter Password

Graham Yes No test

Nick Yes Yes nick

Julie No Yes

I done a routine to basically go through all the name and create a combo
box. I then have another routine which sorts them so they are alphabetical
and displayed on the form

The form allows the selection off the username and then a textbox for a
password and then a login button.

The code to populate the listbox is as follows

How can I get it to test each value for if the login is true then add them
to the combo box otherwise skip to the next row


I need some code to look up the name and the password when the login button
is clicked. so it will match the name and then go and check the password
field and test if they are equal.. otherwise display a msgbox and return to
the form..

I haven't really done any look up stuff which check different values in the
same row and stuff so if people could explain the ways of doing this I would
be gratefull

Set SourceWB = Workbooks.Open("F:\Documents and
Settings\nick\Desktop\Bradrail\system\users", _

False, True)

' this is the username block at present

ListItems = SourceWB.Worksheets(1).Range("A2:A6").Value

' get the values you want

SourceWB.Close False ' close the source workbook without saving

Set SourceWB = Nothing

ListItems = Application.WorksheetFunction.Transpose(ListItems)

' convert values to a vertical array

For i = 1 To UBound(ListItems)

.AddItem ListItems(i) ' populate the listbox

Next i

.ListIndex = -1 ' no items selected, set to 0 to select the first

' Call sort listbox sub to organise list in to alphabetical order

Call SortListBox(cboUserList)



No Answers Found. Be the First, To Post Answer.