![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Boston, MA
Posts: 105
|
I have the code below in one of my worksheets. When I first put the code there it worked great. I could double click on a cell, and it took me to the sheet with that cell's name. I tried it today, and i get nothing. What am I missing?
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) On Error Resume Next Sheets(Target.Value).Select End Sub |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi,
Remove the On Error statement and report back what happens. Do you get an error or does nothing happen? Jay |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Boston, MA
Posts: 105
|
I took out the error statement and got a run-time error '13' Type mismatch and it highlighted Sheets(Target.Value).Select
The sheet has some merged cells, but otherwise just text. |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) On Error Resume Next Sheets(CStr(Target.Value)).Select End Sub |
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Boston, MA
Posts: 105
|
No luck. Same error, same line. I really don't understand why this would work yesterday, but not today. What can you do to disable code in worksheets?
|
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
-------------------------- Sub test() Application.EnableEvents = True End Sub ------------------------- Then, try the double click again. I am guessing that your enable event setting was set to false. Jay |
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Location: Boston, MA
Posts: 105
|
Good guess, but no luck there either.
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi,
Sorry. I cannot duplicate the error. Possibly double click on one of the sheet tabs and copy the text. Paste to the corresponding cell on the main sheet. Other than that, I am at a loss. Jay |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Mar 2002
Location: Boston, MA
Posts: 105
|
Just an update...
I found the error. The cells I wanted to double-click on were merged cells, and the script could not recognize what the value of the merged cells was. As soon as I unmerged them it worked. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|