I broke VBA
heres my sub
Sub testing2() With Application .DisplayAlerts = True .EnableEvents = True .ScreenUpdating = True End With Range("F1").Value = 6 Debug.Print "ran" End Sub It does the first statement but will not execute the second. Nothing else is open, nothing else is executed. What could possible be going on. Range F1 does get updated to 6 but the debug line or for that matter anything after the Range("F1").Value line does not run. Has anyone ever had this problem. tried restarting excel but haven't tried running it on another machine. Issue only happens on one workbook. |
I broke VBA
What else do you think it is supposed to do besides set the value in F1 = 6
and print the work "ran" in the Immediate window? "lukecs" wrote: heres my sub Sub testing2() With Application .DisplayAlerts = True .EnableEvents = True .ScreenUpdating = True End With Range("F1").Value = 6 Debug.Print "ran" End Sub It does the first statement but will not execute the second. Nothing else is open, nothing else is executed. What could possible be going on. Range F1 does get updated to 6 but the debug line or for that matter anything after the Range("F1").Value line does not run. Has anyone ever had this problem. tried restarting excel but haven't tried running it on another machine. Issue only happens on one workbook. |
I broke VBA
I suspect you haven't got the immediates window visible when you run that code from the VBE, all its supposed to do is show 6 in F1 and show the word "run" in the immediates window. -- The Code Cage Team Regards, The Code Cage Team www.thecodecage.com ------------------------------------------------------------------------ The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=8749 |
I broke VBA
By second statement you mean - Debug.Print "ran"?
What are you expecting it to do? It is working fine. Debug output goes to Immediate Window... "lukecs" wrote: heres my sub Sub testing2() With Application .DisplayAlerts = True .EnableEvents = True .ScreenUpdating = True End With Range("F1").Value = 6 Debug.Print "ran" End Sub It does the first statement but will not execute the second. Nothing else is open, nothing else is executed. What could possible be going on. Range F1 does get updated to 6 but the debug line or for that matter anything after the Range("F1").Value line does not run. Has anyone ever had this problem. tried restarting excel but haven't tried running it on another machine. Issue only happens on one workbook. |
I broke VBA
On Oct 29, 4:58*pm, Sheeloo <="to" & CHAR(95) & "sheeloo" & CHAR(64) &
"hotmail.com" wrote: By second statement you mean - Debug.Print "ran"? What are you expecting it to do? It is working fine. Debug output goes to Immediate Window... "lukecs" wrote: heres my sub Sub testing2() * * With Application * * * * .DisplayAlerts = True * * * * .EnableEvents = True * * * * .ScreenUpdating = True * * End With * * Range("F1").Value = 6 * * Debug.Print "ran" End Sub It does the first statement but will not execute the second. *Nothing else is open, nothing else is executed. *What could possible be going on. *Range F1 does get updated to 6 but the debug line or for that matter anything after the Range("F1").Value line does not run. *Has anyone ever had this problem. *tried restarting excel but haven't tried running it on another machine. *Issue only happens on one workbook. ya the VBA exits without an error at Debug.print "ran". It exits right after changing the range no matter what the code before or after. So even if I wrap it with on error goto error_exit or something like that it will still exit. hmmmm I think I may have figured out the issue. A volatile UDF was causing the error. So when the workbook updated a value it calculated the UDF and then caused an error in the function. Its just strange that it exited the sub that I ran this code from without an error message. I guess I need to practice a little more robust error trapping in my UDF's. The error is caused by attempting to use application.evaluate in a UDF that evaluates another UDF that does not properly return an error. Its been corrected by checking for errors in the UDF and returning CVErr(xlErrNA) if there is an error. Thanks for the assistance hopefully provided enough info that it may help someone else in the future. |
I broke VBA
On Wed, 29 Oct 2008 14:35:53 -0700 (PDT), lukecs wrote:
heres my sub Sub testing2() With Application .DisplayAlerts = True .EnableEvents = True .ScreenUpdating = True End With Range("F1").Value = 6 Debug.Print "ran" End Sub It does the first statement but will not execute the second. Nothing else is open, nothing else is executed. What could possible be going on. Range F1 does get updated to 6 but the debug line or for that matter anything after the Range("F1").Value line does not run. Has anyone ever had this problem. tried restarting excel but haven't tried running it on another machine. Issue only happens on one workbook. It works fine for me, in a regular module. How do you know that the debug.print line did not run? --ron |
All times are GMT +1. The time now is 12:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com