I'm trying to create a test before allowing a DoubleClick function to ensure that the DoubleClick only occurs in a particular column (the first column) of a table ("Table9"), before copying the contents of the ActiveCell that was clicked to a cell (C4) on a different worksheet.
The code below errors out with my test, that is attempting to establish a logic function to test if the Active Cell is in Column 1 of the ListObject Table 9.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(ActiveCell, ActiveSheet.ListObjects("Table9").ListColumns(1).DataBodyRange) Then
ActiveCell.Copy Worksheets("Doctor Detail").Range("C4")
Worksheets("Doctor Detail").Activate
End If
End Sub
I'd appreciate any suggestions how to make this function properly.
Thanks
The code below errors out with my test, that is attempting to establish a logic function to test if the Active Cell is in Column 1 of the ListObject Table 9.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(ActiveCell, ActiveSheet.ListObjects("Table9").ListColumns(1).DataBodyRange) Then
ActiveCell.Copy Worksheets("Doctor Detail").Range("C4")
Worksheets("Doctor Detail").Activate
End If
End Sub
I'd appreciate any suggestions how to make this function properly.
Thanks