View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Single stepping gives different result

Where is the code located? If it is in the ThisWorkbook module or a Sheet
module, references resolve differently than if the code is in a standard
module. You should fully qualify the objects. Also, remove any On Error
statements you may have. It might be the case that perhaps the results
depend on what sheet is active and an error is being ignored by an On Error
Resume Next.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Len B" <gonehome@optusnet:con:au wrote in message
...
I have a situation where I want to open a different workbook and go to the
next available row and paste some data there from the calling workbook.

The following code works if I single step through it but not if it runs in
real time. Why is that? Is there a better way to achieve what I am after?

In real time it just opens the workbook to where it was last saved - a
different sheet altogether and it doesn't select A21 in that sheet either.
So that's 2 statements that do not execute in real time.

If Not WBIsOpen(stExportBook) Then ' workbook isn't open so
Workbooks.Open stExportFull, 0 ' so open it without updates
Sheets("Capital Work (CAPEX)").Select
Range("A21").Select
End If

TIA
--
Len
__________________________________________________ ____