Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello:
I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The events you mentioned apply to the ThisWorkbook module. Just check the
name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, it works great, however, how can I make that I should not need to
enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe something like
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What about ranges? How can I make that the event should only work in a
certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What about ranges? How can I make that the event should only work in a
certain range? You can't restrict an event to trigger for only a range of cells. You can, however, test the Target parameter, which is a reference to the cell that initiated the event. If Target is within some range, run your code. Otherwise, don't run the code. For example, the following code shows how to restrict BeforeDoubleClick to take action only if the user double-clicks somewhere within A1:A10. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Me.Range("A1:A10")) Is Nothing Then ''''''''''''''''''''''''''''' ' your event code goes here ''''''''''''''''''''''''''''' End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 10:33:00 -0800, art wrote: What about ranges? How can I make that the event should only work in a certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Workbook_SheetBeforeDoubleClick(ByVal _
Sh As Object, ByVal Target As Range, Cancel As Boolean) Const MY_RANGE As String = "A1:A10" 'adjust to suit Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else If Not Intersect(Target, ActiveSheet.Range(MY_RANGE)) Is Nothing Then MsgBox "you have d-clicked on " & ActiveCell.Address Cancel = True End If End Select End If Next x End Sub Gord Dibben MS Excel MVP On Sun, 16 Nov 2008 10:33:00 -0800, art wrote: What about ranges? How can I make that the event should only work in a certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a named range "GridCell". How can I restict it only to that range?
"Chip Pearson" wrote: What about ranges? How can I make that the event should only work in a certain range? You can't restrict an event to trigger for only a range of cells. You can, however, test the Target parameter, which is a reference to the cell that initiated the event. If Target is within some range, run your code. Otherwise, don't run the code. For example, the following code shows how to restrict BeforeDoubleClick to take action only if the user double-clicks somewhere within A1:A10. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Me.Range("A1:A10")) Is Nothing Then ''''''''''''''''''''''''''''' ' your event code goes here ''''''''''''''''''''''''''''' End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 10:33:00 -0800, art wrote: What about ranges? How can I make that the event should only work in a certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There is a error saying method or data member not found?
"Chip Pearson" wrote: What about ranges? How can I make that the event should only work in a certain range? You can't restrict an event to trigger for only a range of cells. You can, however, test the Target parameter, which is a reference to the cell that initiated the event. If Target is within some range, run your code. Otherwise, don't run the code. For example, the following code shows how to restrict BeforeDoubleClick to take action only if the user double-clicks somewhere within A1:A10. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Me.Range("A1:A10")) Is Nothing Then ''''''''''''''''''''''''''''' ' your event code goes here ''''''''''''''''''''''''''''' End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 10:33:00 -0800, art wrote: What about ranges? How can I make that the event should only work in a certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Range("GridCell")) Is Nothing Then '''''''''''''''''''''''''''''''''' ' do your double-click code here ''''''''''''''''''''''''''''''''' Cancel = True End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 15:53:00 -0800, art wrote: I have a named range "GridCell". How can I restict it only to that range? "Chip Pearson" wrote: What about ranges? How can I make that the event should only work in a certain range? You can't restrict an event to trigger for only a range of cells. You can, however, test the Target parameter, which is a reference to the cell that initiated the event. If Target is within some range, run your code. Otherwise, don't run the code. For example, the following code shows how to restrict BeforeDoubleClick to take action only if the user double-clicks somewhere within A1:A10. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Me.Range("A1:A10")) Is Nothing Then ''''''''''''''''''''''''''''' ' your event code goes here ''''''''''''''''''''''''''''' End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 10:33:00 -0800, art wrote: What about ranges? How can I make that the event should only work in a certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() What exactly does the error message say (details count) and on what line of code does execution terminate (that line will be highlighted in yellow)? Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 16:13:01 -0800, art wrote: There is a error saying method or data member not found? "Chip Pearson" wrote: What about ranges? How can I make that the event should only work in a certain range? You can't restrict an event to trigger for only a range of cells. You can, however, test the Target parameter, which is a reference to the cell that initiated the event. If Target is within some range, run your code. Otherwise, don't run the code. For example, the following code shows how to restrict BeforeDoubleClick to take action only if the user double-clicks somewhere within A1:A10. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Me.Range("A1:A10")) Is Nothing Then ''''''''''''''''''''''''''''' ' your event code goes here ''''''''''''''''''''''''''''' End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 10:33:00 -0800, art wrote: What about ranges? How can I make that the event should only work in a certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks it works now. One more thing. The range gridcell was named for cell in
sheet1, however I want the named range to apply to all sheets, how can I do this? "Chip Pearson" wrote: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Range("GridCell")) Is Nothing Then '''''''''''''''''''''''''''''''''' ' do your double-click code here ''''''''''''''''''''''''''''''''' Cancel = True End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 15:53:00 -0800, art wrote: I have a named range "GridCell". How can I restict it only to that range? "Chip Pearson" wrote: What about ranges? How can I make that the event should only work in a certain range? You can't restrict an event to trigger for only a range of cells. You can, however, test the Target parameter, which is a reference to the cell that initiated the event. If Target is within some range, run your code. Otherwise, don't run the code. For example, the following code shows how to restrict BeforeDoubleClick to take action only if the user double-clicks somewhere within A1:A10. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Not Application.Intersect(Target, _ Me.Range("A1:A10")) Is Nothing Then ''''''''''''''''''''''''''''' ' your event code goes here ''''''''''''''''''''''''''''' End If End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Nov 2008 10:33:00 -0800, art wrote: What about ranges? How can I make that the event should only work in a certain range? "Tom Hutchins" wrote: Maybe something like Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Dim x As Long For x = 1 To Sheets.Count If Sheets(x).Name = Sh.Name Then Select Case x Case 3, 5, 7 'skip these sheets Exit For Case Else 'your event code End Select End If Next x End Sub Hope this helps, Hutch "art" wrote: Thanks, it works great, however, how can I make that I should not need to enter the "Name" of the sheet, rather I should enter which sheet number it is. Like worksheet(1)... Thanks. "Tom Hutchins" wrote: The events you mentioned apply to the ThisWorkbook module. Just check the name of the sheet from which the event was called. If it is one of the sheets where you don't want the code to work, exit the sub. Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) Select Case Sh.Name Case "NotThisSheet1", "NotThisSheet2", "NotThisSheet3" Exit Sub Case Else 'do your event code End Select End Sub Hope this helps, Hutch "art" wrote: Hello: I have a Workbook_SheetBeforeDoubleClick and Workbook_SheetBeforeRightClick event that does certain things when triggered. How ever, I need this event to apply only to certain sheets. I have about 20 sheets, and I don't want to put it in each sheet seperatly. Is there a way to force the workbook event to kick in only for specific sheets? Also, I need the event to apply only to a certain range in the sheet. How can I apply that as well to the code? Please help me figure this out. Thanks for your help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Programming | |||
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? | Excel Programming | |||
Same event, multiple sheets? | Excel Discussion (Misc queries) |