View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Hydra Hydra is offline
external usenet poster
 
Posts: 38
Default Code Execution has been interrupted

the code is huge but I can show part of it. I'e already broken it into
pieces, but maybe I can do more.

No dice on the other. I can reboot the pC and still have the same problem.

-------------------------------------------

Set Myrange = Worksheets("Sheet1").Range("A1: A" & nrows)

'Count the number of summary rows in the sheet and make sure you are
back to the first cell
NumberOfSummaries = Application.WorksheetFunction.CountIf(Myrange,
"SUMMARY:")
'MsgBox ("Number of WBS Elements = " & NumberOfSummaries)
Range("a1").Select


'Redimension the variables to hold all the values needed for the sumaries
ReDim WBSNOS(NumberOfSummaries) 'Variable to hold WBS Numbers
ReDim WBSROW(NumberOfSummaries) ' VAriable to hold the Row Number for
the Summaries
ReDim Addr(NumberOfSummaries) ' Variable to hold the Address for the row
with data needed.


'-------------------Fill the Data arrays for Cost locations

'Run this loop once for each WBS Item Searching for the word "Summary"
'Summary Rows contain the WBS Number
For Counter = 1 To NumberOfSummaries

Cells.Find(What:="SUMMARY:", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate

' First find the Summary Row and record the WBS number
' And the Row Number for the Summary Row
WBSNOS(Counter) = ActiveCell.Offset(0, 1).Value
WBSROW(Counter) = ActiveCell.Row

'Then find the Next row that contains the words "Total Price"
Cells.Find(What:="Price", After:=ActiveCell, LookIn:= _
xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate



'Record the Address for the Total Price Row
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, -1).Select
Addr(Counter) = ActiveCell.Address


--------------------------------------------------------------------------------


This last line is where it usuallly hangs up. Then hit the continue button
and off you - for another four or five loops.


"Sheet 1" is around 4000 lines and 72 columns.

"JP" wrote:

How about, post your code?

--JP

On Sep 25, 3:10 pm, Hydra wrote:
Still having a problem with this.
As long as I hit the continue button, the code executes perfectly.

It is running a loop with a find statement in it, and then it writes the
data to an array vaiable. That is where it ususally, but not always hands up.

I tried putting in a wait statement so it could catch up, but no luck.

It executes the loop 3,4, 5, 6 times, and then hangs up.

Any more suggestions?