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 6105447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:58:27+00:00 2026-05-23T13:58:27+00:00

So this question is two parts. The first is seeing whether there is a

  • 0

So this question is two parts. The first is seeing whether there is a quick and simple code that I can incorporate into my current sub to check how fast the sub will take to run. I just need precision down to seconds, and up to maybe a couple of minutes.

The 2nd is I am currently trying to optimize the run time of my sub. It is a search function that allows a user to specify which variables to select to search for and displays the results on the following worksheet. I’ve surfed the net and I’ve done the following general applications to speed up my program

  1. disable screen updating at the beginning of my sub
  2. avoid copy&paste to clipboard as much as possible

However, my program still takes ~5 to 10 seconds to run everytime the user runs a search. I would like to decrease this time as much as possible.

I realize without looking at my code it is hard to give specific suggestions, but I am currently just looking for general suggestions. If it is still slow after the general principles have been implemented I will post my code here.

My search program is a linear search program and stores the values into an array. My search function can accomodate up to 4 search variables though and I store each search into an array and I consolidate the array at the end into a final results array.

  • 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-23T13:58:28+00:00Added an answer on May 23, 2026 at 1:58 pm

    I generally use the GetTickCount API function. As long as you’re not intending to measure time over weeks or months it should be accurate. Below is an example that shows different looping measures being timed. 1 tick = 1ms

    Private Declare Function GetTickCount Lib "kernel32" () As Long 
    
    Sub test() 
    Dim nTime 
    
    nTime = GetTickCount 
    Set load_array = Range("a5:z65000") 
    array_index = WorksheetFunction.Match("Test 15", WorksheetFunction.Index(load_array, 0, 1), 0) 
    
    rngtimer = GetTickCount - nTime 
    
    
    nTime = GetTickCount 
    load_array = Range("a5:z65000").Value 
    array_index = WorksheetFunction.Match("Test 15", WorksheetFunction.Index(load_array, 0, 1), 0) 
    
    arraytimer = GetTickCount - nTime 
    
    
    nTime = GetTickCount 
    load_array = Range("a5:z65000").Value 
    For a = LBound(load_array) To UBound(load_array) 
    If load_array(a, 1) = "Test 15" Then 
    array_index = a 
    End If 
    Next 
    
    arraylooptimer = GetTickCount - nTime 
    
    nTime = GetTickCount 
    
    For a = 1 To 65000 
    If Range("a5").Offset(a, 0) = "Test 15" Then 
    array_index = a 
    End If 
    Next 
    
    excelooptimer = GetTickCount - nTime 
    
    MsgBox ("Range Search: " & rngtimer & vbCrLf & _ 
    "Array Search: " & arraytimer & vbCrLf & _ 
    "ArrayLoop Search: " & arraylooptimer & vbCrLf & _ 
    "ExcelLoop Search: " & excelooptimer) 
    End Sub 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question actually has two parts. The first part: I've been developing my first
This is a two part question. First how can I grab the last url
Actually this is a two parts question: First, is ip2long a good IP validator?
This question has two parts. First, I need to isolate two strings of text
This is actually a two part question. First,does the HttpContext.Current correspond to the current
Background This question is in two parts. I have a one-way WCF operation hosted
Actually, this question seems to have two parts: How to implement pattern matching? How
This is a somewhat low-level question. In x86 assembly there are two SSE instructions:
This is a two part question, but I want to make sure the first
The question is in two parts. The first is conceptual. The next looks at

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.