#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,805
Default 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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I Broke Excel 2007 and can't fix it. JohnH Setting up and Configuration of Excel 0 September 11th 09 01:30 PM
External Query Link broke Jerry[_3_] Links and Linking in Excel 1 August 7th 07 02:56 PM
link broke RobcPettit[_2_] Excel Programming 5 February 2nd 07 03:26 AM
I broke my Excel!! grime[_22_] Excel Programming 4 July 24th 06 06:12 PM
PageBreak-broke? nope Excel Programming 13 January 11th 05 03:54 PM


All times are GMT +1. The time now is 11:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"