Hi
I'm trying to achieve the above on a user form with the below code and keep getting a key type error! can any one please help!?!
I'm trying to achieve the above on a user form with the below code and keep getting a key type error! can any one please help!?!
Code:
Sub remove_key_click()
Dim kName As String
kName = cbo_KN.Value
If Worksheets("Keys").Range("KeyName").Value = kName Then
ans = MsgBox("Delete " & kName & " from list?", vbYesNo)
If ans = vbYes Then
Worksheets("Keys").Range("KeyName").EntireRow.Delete
End If
End If
MsgBox "The Key has been deleted!"
End Sub
Private Sub UserForm_Initialize()
cbo_KN.List = Worksheets("Keys").Range("KeyName").Value
cbo_KID.List = Worksheets("Keys").Range("KeyID").Value
cbo_KCAT.List = Worksheets("Keys").Range("KeyCatergory").Value
cbo_CNM.List = Worksheets("Contacts").Range("Contacts").Value
cbo_CID.List = Worksheets("Contacts").Range("ContactID").Value
cbo_CDPT.List = Worksheets("Contacts").Range("ContactDept").Value
cbo_CEML.List = Worksheets("Contacts").Range("ContactEmail").Value
cbo_UNM.List = Worksheets("users").Range("users").Value
End Sub