juke_juke13
Board Regular
- Joined
- May 25, 2004
- Messages
- 57
I have the following code and can't quite get it to work as it always tells me the value is not found.
Purpose: Double-click on a cell in Sheet1 and have it look for the value in that cell in Sheet2
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Search As String
On Error GoTo ErrorCatch
Search = Target.Value
'Sheet2
Sheets("Holdings").Select
Columns("A:C").Select
Selection.Find(What:=Search, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Exit Sub
ErrorCatch:
MsgBox "Search item not found"
End Sub
Purpose: Double-click on a cell in Sheet1 and have it look for the value in that cell in Sheet2
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Search As String
On Error GoTo ErrorCatch
Search = Target.Value
'Sheet2
Sheets("Holdings").Select
Columns("A:C").Select
Selection.Find(What:=Search, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Exit Sub
ErrorCatch:
MsgBox "Search item not found"
End Sub