Reputation: 23
I've developed an excel addin that imports sheets into the existing one. i would like to be able to double click anywhere and be able to jump back to the first sheet.
Private Sub Worksheet_BeforeDoubleClick(ByVal target As Range, cancel As Boolean)
Sheets(1).Select
cancel = True
End Sub
Another program writes a summary excel file. I've developed a add-in macro that when opened and run, Imports the full solution sheets and do some data manipulation. is there a way to transfer this code into the excel sheet vba project? thanks in advance
Upvotes: 0
Views: 161
Reputation: 683
Press Alt+F11
to go to VBA development tab and then in the tab on the left there should be displayed your Excel worksheets.
Simply double click on the worksheets you want to apply that feature and paste the code :)
See this image for more details about where to click: https://www.extendoffice.com/images/stories/doc-excel/doc-drop-down-list-prevent-paste/doc-drop-down-list-prevent-paste-1.png
Upvotes: -1
Reputation: 29421
use workbook events
so type in ThisWorkbook code pane the following:
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Sheets(1).Select
Cancel = True
End Sub
Upvotes: 3