First of all: What are you trying to do here?
I reduced it to a variable LastRow but what does it invoke, doesn't work here but that clear because I do not have the refresh connection which seems to be the the same file but I have to figure it out.
And where do you want the search to show up, at which moment?
Could you please explain this? It overwrites the active cell in A or whatever you have as active cell with the now() value
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim lastRow As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row + 1
If Not Intersect(Target, Union(Range("D2:D" & lastRow), Range("E2:E" & lastRow), Range("A2:A" & lastRow))) Is Nothing Then
Cancel = True
Target.Formula = Now()
End If
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet
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
Cancel = True
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 = str
.LinkedCell = Target.Address
End With
cboTemp.Activate
'open the drop down list automatically
Me.TempCombo.DropDown
End If
errHandler:
Application.EnableEvents = True
Exit Sub
End Sub
Bookmarks