Trying to use "Call" to make a jump to 2nd subroutine but it always gives me errors

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
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:
I want to make a addin so that we just run throw addin regardless of work sheet and it will highlight rows. I don’t want to put it into this workbook manually.

Open any any file➡️ Run addin➡️Highlight rows

Hello Shayanhaque

In your first post, it sounded as if you wanted this 'addin' as you call it, it's actually an EVENT, to work with any sheet within the workbook you have open. The code and placement instructions you have been given will do that. To the best of my knowledge, that is the only way to make it happen. Now in your posting #9, you seem to be wanting this action to occur when you open ANY workbook and not just this one. That is two, totally different things, you are talking about.


If what you want to happen is that Excel will automatically run this code ANYTIME you open ANY workbook that is stored on your computer, and/or presumably create a new one, I believe there is a way to make this happen. Keeping in mind, this action will happen from now on for any workbook you ever open. I've never tried doing something like this, but if you go to this link, I believe it will take you through the steps to create a hidden PERSONAL.XLSB workbook into which you can store macros for use in any open workbook on your computer. From what I understand of this process, it will re-configure Excel.


https://www.myonlinetraininghub.com/create-a-personal-macro-workbook-personal-xlsb


If this is what you want,
I for one would appreciate it after you get this working, you'd come back to this thread and let us know if it works. I hope this will be of help to you. Good luck.


TotallyConfused
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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