LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Bizarre macro problem

I think it was the combination of doEvents and releasing the shiftkey.

Andy wrote:

Hi Tony

Your first suggestion works!!! In fact I only needed to add DoEvents before
opening the workbook.

Out of interest I tried error trapping but that didn't work.

Thank you all sooooo much for your help and for maintaining my sanity!
Andy

"tony h" wrote:


two suggestions

1. try using a doevents just before and after your troublesome line.
The doEvents statement tell excel to stop doing what it is doing and
let other processes have a go. It maybe that your breakpoint is just
releasing the process and that the doevents would do the same thing.

2. Put an error trap around the code. depending on how the code was
activated an error may just halt the code. It is particularly important
to do this in user defined functions and dependant code that is called
from the worksheet.

Sub mycode()

Dim str As String

On Error GoTo AnError

'my code ...........
str = 1 / 0

GoTo TheEnd
AnError:
MsgBox "error : " & Err.Number & " " & Err.Description
Stop 'you will have to decide what to do here
TheEnd:

End Sub

hope this helps


--
tony h
------------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074
View this thread: http://www.excelforum.com/showthread...hreadid=392442



--

Dave Peterson


 
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
Bizarre XLA behaviour [email protected][_2_] Excel Discussion (Misc queries) 4 March 11th 09 03:35 PM
Bizarre Excel 03 Problem - autosum not updating when cells are cha Angela Excel Worksheet Functions 2 June 30th 07 01:48 AM
Bizarre MS EXCEL problem - files will not open via document ICONs Filk.com Excel Discussion (Misc queries) 2 May 5th 06 05:59 PM
Bizarre Project Explorer in VBE Tetsuya Oguma[_4_] Excel Programming 5 August 6th 04 03:05 AM
Bizarre and frustrating bug NJD Excel Programming 5 January 28th 04 09:50 PM


All times are GMT +1. The time now is 12:58 PM.

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

About Us

"It's about Microsoft Excel"