Error ONLY when double-clicking Cat9 - RT error 91

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
This code works fine when I double click on Cat1 through Cat8; But I get R/T 91 - ERROR ONLY
when I double-click on Cat9 (Only). What could be my problem?

TIA, Jim

Rich (BB code):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim MyMacro
Cancel = True
MyMacro = Target.Value
Select Case MyMacro
    Case "Cat1"
        ActiveSheet.ListObjects("Table1").Range.Select
    Case "Cat2"
        ActiveSheet.ListObjects("Table1").HeaderRowRange.Select
    Case "Cat3"
        ActiveSheet.ListObjects("Table1").DataBodyRange.Select
    Case "Cat4"
        ActiveSheet.ListObjects("Table1").ListColumns(3).Range.Select 
    Case "Cat5"
        ActiveSheet.ListObjects("Table1").ListColumns(3).DataBodyRange.Select
    Case "Cat6"
        ActiveSheet.ListObjects("Table1").ListRows(4).Range.Select
    Case "Cat7"
        ActiveSheet.ListObjects("Table1").HeaderRowRange(3).Select
    Case "Cat8"
        ActiveSheet.ListObjects("Table1").DataBodyRange(3, 2).Select
    Case "Cat9"
        ActiveSheet.ListObjects("Table1").TotalsRowRange.Select  << This Line HIGHLIGHT with Yellow After Debug
    Case Else
    'Do Nothing
End Select
End Sub
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Does Table1 have a totals row?
 
Upvote 0

Forum statistics

Threads
1,215,545
Messages
6,125,450
Members
449,227
Latest member
Gina V

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top