LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default Macro Halting During Execution

As part of a large macro I have the code shown below. I have distributed the
macro to scores of users. For some of them the macro halts execution at the
last line of code shown below. They can click on the run sub/user form button
in the VB editor and the macro will then run to conclusion. Any ideas as to
why it would break for some folks at that line of code? I'm baffled.

For ILoop = 1 To ShCount
Sheets(ILoop).Activate
UndCount = 0
Rows(1).Delete
NumRows = Cells(Rows.Count, "C").End(xlUp).Row
'Get samples for UO and AP.
If (Left(ActiveSheet.Name, 3)) = "UND" Then
For Iloop2 = 1 To NumRows
If Application.CountA(Range("G" & Iloop2 & ":I" & Iloop2)) 0
Then
UndCount = UndCount + 1
Cells(Iloop2, "J") = UndCount
UndTtl = UndTtl + Cells(Iloop2, "G") + Cells(Iloop2, "H") +
Cells(Iloop2, "I")
End If
Next Iloop2
If UndCount < 16 Then
For Iloop2 = 1 To NumRows
If Not IsEmpty(Cells(Iloop2, "J")) Then
Cells(Iloop2, "J") = "X"
End If
Next Iloop2
Else
Num = 15
t = UndCount
GenNUniqueRandom
For Iloop2 = 1 To Num
For Iloop3 = 1 To NumRows
If Cells(Iloop3, "J") = RndNo(Iloop2) Then
Cells(Iloop3, "J") = "X"
Exit For
End If
Next Iloop3
Next Iloop2
End If
Cells(NumRows + 2, "A") = "Total count of records 90 days old"
Cells(NumRows + 2, "D") = UndCount
Cells(NumRows + 3, "A") = "Total dollar value of records 90 days
old"
Cells(NumRows + 3, "D") = UndTtl
UndCount = 0
UndTtl = 0
Else
'Get samples for non-MCCF AR.
For Iloop2 = 1 To NumRows
If Application.CountA(Range("G" & Iloop2 & ":I" & Iloop2)) 0
And _
Not IsEmpty(Cells(Iloop2, "B")) And _
IsNumeric(Mid(Cells(Iloop2, "C"), 8, 1)) Then
ARCount = ARCount + 1
ARTtl = ARTtl + Cells(Iloop2, "G") + Cells(Iloop2, "H") +
Cells(Iloop2, "I")
Cells(Iloop2, "J") = ARCount
End If
Next Iloop2
If ARCount < 11 Then
--
Ken Hudson
 
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
Halting Execution -- A Newbie Question (possible repeat, sorry) John V[_2_] Excel Programming 1 February 13th 08 07:00 PM
Halting the Worksheet_Change event Jim McLeod Excel Programming 2 April 26th 04 02:31 PM
#REF! Halting my Macro JMay Excel Programming 10 September 21st 03 08:03 PM
halting macro Jonas O Excel Programming 1 July 9th 03 01:56 PM
halting macro Jonas O Excel Programming 3 July 9th 03 12:48 PM


All times are GMT +1. The time now is 08:49 AM.

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"