Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Excel VBA: cant get a match, error unable to get the match property of the WorksheetFunction class For the love of all that is good,

Excel VBA: cant get a match, error unable to get the match property of the WorksheetFunction class
For the love of all that is good, I cannot seem to get this to work. I keep getting the error mentioned above.
I have this table and im making a user authority level login, and I'm trying to find out whether the password matches it's own user ID to login to the sheet, however it's erroring out. Your help is greatly appreciated.
image text in transcribed
image text in transcribed
image text in transcribed
User Management Worksheets sheet1 sheet2 sheet3 User ID User Name Role Password 35120001 Nada azd Admin 567 35120002 Mohammad Saad User 123 35120003 Farah Nasser User 123 35120004 Manar Mohammad User 123 35120005 Khaled Aziz User 123 35120006 Maha Fares User 123 Unlocked Unlocked Unlocked Locked Hidden Unlocked Unlocked Unlocked Unlocked Locked Hidden Locked Unlocked Unlocked Unlocked Locked Hidden Locked Unlocked Unlocked Unlocked Locked Hidden Locked Visual Basic for Applications Run-time error '1004": Method 'Match' of object 'WorksheetFunction' failed Help Continue End Debug Login Login: User Name 35120001 Password 567 Login Password Reset Click CommandButton1 MsgBox "Please enter the User ID", vbCritical Exit Sub End If If Me.txt_Password.Value = "" Then MsgBox "Please enter the password", vbCritical Exit Sub End If If Application.WorksheetFunction.Countif(sh.Range("A:A"), Me.txt_UserName.Value) = 0 Then MsgBox "User ID does not exists", vbCritical Exit Sub End If Dim user_row As Integer user_row = Application WorksheetFunction Match(Me.txt_UserName.Value, sh.Range("A:A", 0) if CStr(sh.Cells(user_row, 4).Value) Me.txt_Password.Value Then MsgBox "Invalid password", vbCritical Exit Sub End If Check the Worksheet Access ... Dim lock_worksheet, unlock_worksheet As Integer lock_worksheet = Application WorksheetFunction.Countif(sh.Range("E & user_row, "XFD" & user_row), "Locked") unlock_worksheet = Application WorksheetFunction.Countf(sh.Range("E" & user_row, "XFD" & user_row), "Unlocked")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions