Can't run vba in debug mode

animas

Active Member
Joined
Sep 28, 2009
Messages
396
I have subs with arguments. I can't run the debug modes for these subs. When I remove the argument, debugging starts working.

What could be the issue?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi animas,

Can you post an example of one of your subs so we can see what is going on.

ColinKJ
 
Upvote 0
Code:
Option Explicit

Sub TestMe1(ByVal tst As String)
    MsgBox "hello 1"
End Sub

Sub TestMe2()
    MsgBox "hello 2"
End Sub

F8 doesn't enter into Step Into mode for TestMe1 . But works fine with TestMe2. TestMe1 is also not shown in Macro list.
 
Upvote 0
Hi

The reason you can't debug this sub directly:

Code:
Sub TestMe1(ByVal tst As String)
    MsgBox "hello 1"
End Sub

Is because it is expecting to be called along with the variable "tst".

It is also why it doesn´t show in the macro list.

While it is expecting the variable "tst", it isn't being used in the routine.

Do you know where in your codes you are calling the routine "TestMe1"

ColinKJ
 
Upvote 0
Ya. If i step into from the calling sub, it works ok.
But as far as I remember I was able to step into with arguments sub until today. Are you sure that is not allowed?
 
Upvote 0
You would need to call your routine (with variables which need passing) either by calling it from another sub/function or the immediate window. Probably one of the easiest ways to then step through it is to put a breakpoint on the first line of your sub (F9 is the shortcut key to add a breakpoint to a line, or click on the left of the margin).
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,513
Members
452,921
Latest member
BBQKING

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