Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 755397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:07:31+00:00 2026-05-14T15:07:31+00:00

everyone. Here is a small VBA (Excel) function that i wrote, full of MsgBoxes

  • 0

everyone. Here is a small VBA (Excel) function that i wrote, full of MsgBoxes for debugging.

I am passing in the numbers 10 and 1 as arguments, and getting an overflow error when the program reaches the top of the For loop, before it begins the first iteration.

Any thoughts are appreciated.

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Function PerformanceTest(iterations As Integer, interval As Integer) As Double
    Dim st, tot, k As Double
    Dim n As Integer
    tot = 0#
    MsgBox "ok"
    k = iterations + tot
    MsgBox "ookk"
    n = 1
    MsgBox "assigned"
    For n = 1 To iterations
        MsgBox n
        st = Timer
        Application.Calculate
        tot = tot + (Timer - st)
        Sleep (1000 * interval)
    Next n
    'MsgBox (tot / k)
    PerformancTest = tot / k
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:07:32+00:00Added an answer on May 14, 2026 at 3:07 pm

    Redundancy removed, the essentially unchanged function runs without error in my Excel 2003

    Function PerformanceTest(iterations As Integer, interval As Integer) As Double
      Dim st, tot As Double
      Dim n As Integer
    
      For n = 1 To iterations
        st = Timer
        Application.Calculate
        tot = tot + Timer - st
        ''# Sleep (1000 * interval)
      Next n
    
      PerformanceTest = tot / (iterations + tot)
    End Function
    

    So… the error you see is probably not within the function itself.

    P.S.: Pro tip: 😉 Use Debug.Print instead of MsgBox for debug output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First question here so hello everyone. The requirement I'm working on is a small
i hope that everyone here know the php 'variable variable' syntax: $color = 'red';
I assume everyone here is familiar with the adage that all text files should
I think everyone here would be knowing that, if I am logged in any
I think everyone here would agree that in order to be considered a professional
Hello everyone here is my DAO class : public class UsersDAO extends HibernateDaoSupport {
Ahoy hoy everyone :) Here is a list of links. You will need it
I thought to share this relatively smart problem with everyone here. I am trying
I'm trying to create a web application project template for everyone to use here
everyone! new to here and been pondering about this myself for some times with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.