PDA

View Full Version : Rookie: Working with Private Subs



dchung1
06-11-2015, 01:44 PM
Hi Folks,

I am watching some excel videos on udemy, and I came across this issue. Everytime I hit the f5 button it opens a macro window and asking me to load a macro. This is while working on a private worksheet. Any insight on how to fix this?

SamT
06-11-2015, 02:05 PM
?

I used to have the same problem with the Caps lock key. Then I removed it from my keyboard. No more TALKING IN ALL CAPS FOR ME.

In other words, I don't see what problem you are having.

dchung1
06-11-2015, 02:16 PM
?

I used to have the same problem with the Caps lock key. Then I removed it from my keyboard. No more TALKING IN ALL CAPS FOR ME.

In other words, I don't see what problem you are having.


My my compile and debug button does not work when there's an actual code in the screen.

mperrah
06-11-2015, 03:41 PM
Do you have selection within the start and end of a sub in the VB editor?
if your cursor is below the End Sub line you will be prompted for which sub you wish to run

Paul_Hossler
06-11-2015, 03:52 PM
Also, if the cursor is in a sub or function that requires parameters, F5 will ask for the sub to run since you can't run that one

SamT
06-11-2015, 04:06 PM
If there are no blatant errors in your code then you will not see any feedback from Debug >> Compile. Misspell a variable name and try it.

dchung1
06-11-2015, 04:09 PM
If there are no blatant errors in your code then you will not see any feedback from Debug >> Compile. Misspell a variable name and try it.

I think it has something to do with Application.EventsEnabled = True...

Its only in the events sheets and not a module.

dchung1
06-11-2015, 04:13 PM
I know theres no errors. But usually it lets me go into step in mode but it wont even do that. I have reset this project and still for the life of me cant figure out why its doing it. There are a few sheets where this works correctly but not all the time.

mperrah
06-12-2015, 08:09 AM
You can post your workbook by clicking "goadvanced" then we can have at look at this possible issues code wise. :)

Zack Barresse
06-12-2015, 10:28 AM
Maybe I'm missing something, but if you're talking about being in the VBE and pressing F5 brings up a dialog titled "Macros", then your cursor isn't in a sub routine, which means Excel doesn't know what routine you want to run, hence the dialog box. You'll also see this if the sub routine your cursor is in takes parameters as well. You must sepecify any parameters and Excel can't assume them.

I'd recommend using the Immediate Window (CTRL+G). You can just type in the name of the routine and press Enter. Whatever you press Enter on it will execute that line of code.