Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Could somebody look at this code?

  1. #1
    Guest

    Default

    I downloaded a workbook with this code but when I open it it crashes at the point in bold, I think it might have been for Excel 2000, can any one "fix it for '97? Thanks

    Sub Check_Complete()
    Dim cell As Range
    Dim ans As String

    On Error GoTo Incorrect

    For Each cell In Range("c3:n14")
    If cell.Value <> Sheet2.Range(cell.Address) Then GoTo Incorrect
    Next cell

    Dim endtime
    Dim total

    endtime = Timer
    total = Round(endtime - starttime, 0)
    hours = WorksheetFunction.RoundDown(total / 3600, 0)
    minutes = WorksheetFunction.RoundDown(((total - (hours * 3600)) / 60), 0)
    seconds = WorksheetFunction.RoundDown(total - (minutes * 60) - (hours * 3600), 0)

    ans = MsgBox _
    ("Congratulations! You are VERY SMART! It only took you: " & Chr(13) & Chr(13) & _
    " " & hours & " hours, " & minutes & " minutes, " & _
    seconds & " seconds" & Chr(13) & Chr(13) & _
    " " & "Would you like to print your results?", _
    vbYesNo, "HOORAY!!")
    If ans = vbYes Then Call Report

    Incorrect:

    End Sub

  2. #2
    New Member
    Join Date
    Feb 2002
    Location
    Birmingham
    Posts
    13
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try changing the offending line to

    total = WorksheetFunction.Round(endtime - starttime, 0)

  3. #3
    Guest

    Default

    Thanks

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •