I have a pretty elaborate file that uses a lot of cell locking and display box messaging code depending on different varibales within the sheet. The file is made up of many different data validation lists as well. All the locking, messaging, and validation dropdown lists work correctly.
My issue comes when I try to add a Combobox (named "TempCombo") to allow the user to use the autocomplete function option. Once I add the combobox and the corrosponding code I found from the Contextures website, the combobox appears when I select a data validation cell but none of the list options appear in the box.
Any help would be greatly appriciated. I can also email the file to anyone who thinks they may be able to help out.
Thank you.
My issue comes when I try to add a Combobox (named "TempCombo") to allow the user to use the autocomplete function option. Once I add the combobox and the corrosponding code I found from the Contextures website, the combobox appears when I select a data validation cell but none of the list options appear in the box.
Any help would be greatly appriciated. I can also email the file to anyone who thinks they may be able to help out.
Thank you.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
Cancel = True
Set cboTemp = ws.OLEObjects("TempCombo")
On Error Resume Next
With cboTemp
'clear and hide the combo box
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
End With
On Error GoTo errHandler
If Target.Validation.Type = 3 Then
'if the cell contains a data validation list
Application.EnableEvents = False
'get the data validation formula
str = Target.Validation.Formula1
str = Right(str, Len(str) - 1)
With cboTemp
'show the combobox with the list
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 5
.Height = Target.Height + 5
.ListFillRange = ws.Range(str).Address
.LinkedCell = Target.Address
End With
cboTemp.Activate
End If
errHandler:
Application.EnableEvents = True
Exit Sub
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
EventProc1 Target
EventProc2 Target
EventProc3 Target
EventProc4 Target
EventProc5 Target
EventProc6 Target
EventProc7 Target
EventProc8 Target
End Sub
Private Sub EventProc1(ByVal Target As Range)
If Range("E1").Value = "CLOSED" Or Range("I3").Value >= 1.04166666666667 Then
ActiveSheet.Unprotect ("wfmadmin")
Range("D4:D38").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("D4:D38").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub EventProc2(ByVal Target As Range)
If Range("E1").Value = "CLOSED" Or Range("I3").Value >= 1.04166666666667 Then
ActiveSheet.Unprotect ("wfmadmin")
Range("G4:I38").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("G4:I38").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub EventProc3(ByVal Target As Range)
If Range("E1").Value = "CLOSED" Or Range("I39").Value >= 0.166666666666667 Then
ActiveSheet.Unprotect ("wfmadmin")
Range("D40:D43").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("D40:D43").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub EventProc4(ByVal Target As Range)
If Range("E1").Value = "CLOSED" Or Range("I39").Value >= 0.166666666666667 Then
ActiveSheet.Unprotect ("wfmadmin")
Range("G40:I43").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("G40:I43").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub EventProc5(ByVal Target As Range)
If Range("E1").Value = "CLOSED" Or Range("S3").Value >= 0.166666666666667 Then
ActiveSheet.Unprotect ("wfmadmin")
Range("P4:P7").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("P4:P7").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub EventProc6(ByVal Target As Range)
If Range("E1").Value = "CLOSED" Or Range("S3").Value >= 0.166666666666667 Then
ActiveSheet.Unprotect ("wfmadmin")
Range("R4:T7").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("R4:T7").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub EventProc7(ByVal Target As Range)
If Range("G1").Value = "CLOSED" Then
ActiveSheet.Unprotect ("wfmadmin")
Range("P9:P12").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("P9:P12").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub EventProc8(ByVal Target As Range)
If Range("G1").Value = "CLOSED" Then
ActiveSheet.Unprotect ("wfmadmin")
Range("R9:R12").Locked = True
ActiveSheet.Protect ("wfmadmin")
Else
ActiveSheet.Unprotect ("wfmadmin")
Range("R9:R12").Locked = False
ActiveSheet.Protect ("wfmadmin")
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
EventProc9 Target
EventProc10 Target
EventProc11 Target
EventProc12 Target
EventProc13 Target
EventProc14 Target
EventProc15 Target
EventProc16 Target
EventProc17 Target
End Sub
Private Sub EventProc9(ByVal Target As Range)
If Not Intersect(Target, Range("D4:D38")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc10(ByVal Target As Range)
If Not Intersect(Target, Range("G4:I38")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc11(ByVal Target As Range)
If Not Intersect(Target, Range("D40:D43")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc12(ByVal Target As Range)
If Not Intersect(Target, Range("G40:I43")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc13(ByVal Target As Range)
If Not Intersect(Target, Range("P4:P7")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc14(ByVal Target As Range)
If Not Intersect(Target, Range("R4:T7")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc15(ByVal Target As Range)
If Not Intersect(Target, Range("P9:P12")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc16(ByVal Target As Range)
If Not Intersect(Target, Range("R9:R12")) Is Nothing Then
If Target.Locked Then MsgBox "Day closed! Requests & adjustments must be emailed to the Workforce Management Team for approval. Thank you!"
End If
End Sub
Private Sub EventProc17(ByVal Target As Range)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
Set cboTemp = ws.OLEObjects("TempCombo")
On Error Resume Next
If cboTemp.Visible = True Then
With cboTemp
.Top = 10
.Left = 10
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
.Value = ""
End With
End If
errHandler:
Application.EnableEvents = True
Exit Sub
End Sub