My code:
What I am trying to do:
the above code is from my userform;
the userform has a combobox named cboEN;
cboEN lists all the names that are in a named range in row 1 on a worksheet named "Employee Training Matrix";
When a name is selected from the cboEN combobox, and command button cmdCLOSE is selected on the form, what i then need the code to do is to format (change the color, clear the cell, or anythng really just so I can se its working) the cell that contains the name that was selected from the cboEN choices.
I know that the code is working (just not the formatting part), and is finding the correct name, because I put the 2 message boxes in there just so I can see if its found the name, or didnt find the name. (right now when I select a name from cboEN and click on cmdCLOSE, I do get the correct "(NAME cboEN), has been removed." (so thats good at least)
So what should come next is that the cell that contains the same name as cboEN should be filled with a bright green interior color (thats the 65280 color.) I have also tried clearing the cell, changing the font to bold, and a couple other things. None of them change the format. But I do not get an error, and I do get my conformation "(name) has been removed" message box. ??
Its probably something simple, but I am clearly missing it cause i just cant get it to work.
Please and Thank you for any help someone might be able to throw my way.
Code:
Private Sub cmdMOVE_Click()
Dim Nam_ID As String
Dim fCol As Long
Dim wt As Worksheet
Set wt = Worksheets("Employee Training Matrix")
Nam_ID = cboEN
On Error Resume Next
With wt
fCol = .UsedRange.Find(What:=Me.cboEN, After:=.Range("NAMES"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
If fCol = Nam_ID Then
MsgBox Me.cboEN & " has been removed"
Worksheets("Employee Training Matrix").Cells(fCol).Select.Interior.Color = 65280
Unload Me
ActiveWorkbook.Worksheets("Employee Training Matrix").Activate
Else
MsgBox "employee NOT removed"
End If
End With
On Error GoTo 0
Exit Sub
ActiveWorkbook.Worksheets("Employee Training Matrix").Activate
Unload Me
End Sub
What I am trying to do:
the above code is from my userform;
the userform has a combobox named cboEN;
cboEN lists all the names that are in a named range in row 1 on a worksheet named "Employee Training Matrix";
When a name is selected from the cboEN combobox, and command button cmdCLOSE is selected on the form, what i then need the code to do is to format (change the color, clear the cell, or anythng really just so I can se its working) the cell that contains the name that was selected from the cboEN choices.
I know that the code is working (just not the formatting part), and is finding the correct name, because I put the 2 message boxes in there just so I can see if its found the name, or didnt find the name. (right now when I select a name from cboEN and click on cmdCLOSE, I do get the correct "(NAME cboEN), has been removed." (so thats good at least)
So what should come next is that the cell that contains the same name as cboEN should be filled with a bright green interior color (thats the 65280 color.) I have also tried clearing the cell, changing the font to bold, and a couple other things. None of them change the format. But I do not get an error, and I do get my conformation "(name) has been removed" message box. ??
Its probably something simple, but I am clearly missing it cause i just cant get it to work.
Please and Thank you for any help someone might be able to throw my way.