LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Rob
 
Posts: n/a
Default error on second pass of loop.

What I am trying to do is find the total amount of time my site goes down. It
all works when there is only one error in a row, but when it enters the loop
it crashes on it's second pass. Any Suggestions?


Sub Total()

Dim ObjErrorString, ObjOkString
Dim ObjErrorCell, ObjErrorTime
Dim ObjOkCell, ObjOkTime
Dim ObjTotal

Set ObjErrorCell = Cells.Find(What:="ERROR", After:=ActiveCell,
SearchOrder:=xlByColumns, SearchDirection:=xlNext)
ObjErrorString = Left(ObjErrorCell.Offset(1, 0).Value, 5)
Do Until ObjErrorString < "ERROR"
ObjErrorCell = ObjErrorCell.Offset(1, 0)
Set ObjErrorString = Left(ObjErrorCell.Offset(1, 0).Value, 5)
Loop
ObjErrorCell.Select
Set ObjErrorTime = ActiveCell.Offset(0, -ActiveCell.Column + 1)
Set ObjOkCell = Cells.Find(What:="OK", After:=ActiveCell,
SearchOrder:=xlByColumns, SearchDirection:=xlPrevious)
ObjOkCell.Select
Set ObjOkTime = ActiveCell.Offset(0, -ActiveCell.Column + 1)
ObjTotal = ObjOkTime - ObjErrorTime
Range("E389").Value = ObjTotal

End Sub
 
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
VB for excel, how do I loop through code steve hobden via OfficeKB.com Excel Discussion (Misc queries) 2 June 9th 05 01:59 PM
loop trough e-mail address list to send task lists with outlook Paul. Excel Discussion (Misc queries) 2 April 14th 05 11:48 AM
Printe Autofilter Criterias in a Loop Paul. Excel Discussion (Misc queries) 1 March 25th 05 12:51 PM
How to pass values of a cell? Me Excel Discussion (Misc queries) 4 March 4th 05 05:35 PM
pass fail Tricia New Users to Excel 3 January 20th 05 03:45 PM


All times are GMT +1. The time now is 04:53 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"