PDA

View Full Version : [SOLVED:] Code not Executing in Immedate Window--Copy and Paste are Disabled



ScottyBee
03-17-2021, 02:06 PM
Hello,

I have some vba code that copies data to another workbook and formats it. Up until now, I have not had any problems executing my code until today. I am trying to hide columns in another workbook using this code in the Immediate Window:

Screenshot is in the next post, forgot to post it here.

When I hit enter, the column is still visible. I also noticed that I cannot Copy and paste from the selected text as you can see from the screen above. Both workbooks are NOT protected. Somehow my code is being blocked from running.

Any ideas? Thanks

ScottyBee
03-17-2021, 02:09 PM
28120

I did some further testing and found the following. Please refer to below screenshot.

28121

When the Apprentice Hours" workbook has the focus, the code sometimes runs in the immediate window. When it does not run, then the Copy and Paste options are disabled in the Immediate window.

When the "zDontUSE_ApprenticeRelatedTrainingHours" workbook has the focus, the code always runs.

This seem like inconsistent behavior as I am fully qualifying my code so it shouldn't matter what workbook has the focus.

ScottyBee
03-18-2021, 09:32 AM
I got my code to work, just not sure why the Immediate Window or code execution becomes disabled from time to time. Maybe it's just part of the joys of coding. If something does not work, just close out or re-compile the code if I am scratching my head :)

Kenneth Hobs
03-18-2021, 10:57 AM
That can happen if you have a cell in edit mode.

ScottyBee
03-22-2021, 04:39 PM
Thanks Kenneth. I think that is what happened :)