shayanhaque
New Member
- Joined
- Mar 13, 2019
- Messages
- 19
I'm trying to use subroutine for Beforedoubleclick for all available sheets regardless of name or number and (Call Worksheet_BeforeDoubleClick) is giving me various kind of error and won't go to that subroutine. Please assist.
Here's my code
Here's my code
Code:
Sub Dosomething()
Dim pSheet As Worksheet
Application.ScreenUpdating = False
Set pSheet = ActiveSheet
For Each pSheet In Worksheets
Call Worksheet_BeforeDoubleClick
Next
Application.ScreenUpdating = True
End Sub
Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Step 1: Declare Variables
Dim strRange As String
'Step2: Build the range string
strRange = Target.Cells.Address & "," & _
Target.Cells.EntireRow.Address
Target.Cells.EntireRow.Interior.ColorIndex = 3
'Step 3: Pass the range string to a Range
Range(strRange).Select
End Sub
Last edited by a moderator: