Hi Excel-masters,
I am new to this forum, and I read the rules, but please inform me when I'm not abiding to those rules.
Also, I looked into the forum for previous, related questions, but couldn't find one. But if I missed a thread that's already answering my question, please excuse me.
So here it goes,
I have this userform where the user should fill in their UserId(unique), and ItemId(item they want to rent/check out). Then the date of today and the date they have to return this object, are generated automatic if they puch the button. The data is then posted on a protected sheet, to store all the events.
Now, I want to check the UserId the user filled in, with a list of 'registered users'.
But, for the love of god, I can't find a good piece of code for this.
My code looks like this now:
I have to check the UserId.Text-input with all the values in the 'User' worksheet, before the data is plotted in the worksheet.
If it's not in the list, there should be an error.
If it is in the list, it should check the ItemId.Text, with the values in the 'Items' worksheet.
The amount of users/items is not fixed, meaning there can be users/items added in the future, but they still have to be included in the checking. So if on day 1 I only have 2 users/items, it should only check from cell A:2 to A:3, but after day2 there are 5 users/items, so it should check from A:2 to A:6.. so the range is not pre-defined.
Is my question clear? If not, please let me know, and I'll try to explain better.
If I have to upload my whole workbook, let me know!
Kind regards, and thanks in advance.
I am new to this forum, and I read the rules, but please inform me when I'm not abiding to those rules.
Also, I looked into the forum for previous, related questions, but couldn't find one. But if I missed a thread that's already answering my question, please excuse me.
So here it goes,
I have this userform where the user should fill in their UserId(unique), and ItemId(item they want to rent/check out). Then the date of today and the date they have to return this object, are generated automatic if they puch the button. The data is then posted on a protected sheet, to store all the events.
Now, I want to check the UserId the user filled in, with a list of 'registered users'.
But, for the love of god, I can't find a good piece of code for this.
My code looks like this now:
Code:
Private Sub Uitleen_Click()
ThisWorkbook.Sheets("Uitleen").Unprotect Password:="Jeroen"
UitleenDate.Value = "" & Date
DateBack.Value = "" & DateAdd("d", 14, Date)
Worksheets("Uitleen").Activate
eRow = Blad7.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(eRow, 1) = UserID.Text
Cells(eRow, 2) = ItemID.Text
Cells(eRow, 3) = UitleenDate.Text
Cells(eRow, 4) = DateBack.Text
ThisWorkbook.Sheets("Uitleen").Protect Password:="Jeroen"
End Sub
I have to check the UserId.Text-input with all the values in the 'User' worksheet, before the data is plotted in the worksheet.
If it's not in the list, there should be an error.
If it is in the list, it should check the ItemId.Text, with the values in the 'Items' worksheet.
The amount of users/items is not fixed, meaning there can be users/items added in the future, but they still have to be included in the checking. So if on day 1 I only have 2 users/items, it should only check from cell A:2 to A:3, but after day2 there are 5 users/items, so it should check from A:2 to A:6.. so the range is not pre-defined.
Is my question clear? If not, please let me know, and I'll try to explain better.
If I have to upload my whole workbook, let me know!
Kind regards, and thanks in advance.