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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:29:23+00:00 2026-06-10T12:29:23+00:00

Summary: I’m looping through many rows of data and storing data from different columns

  • 0

Summary: I’m looping through many rows of data and storing data from different columns in about 6 different variables each time through the loop

Question: Would I save a very significant amount of CPU cycles using Range("A" & some iterator) as opposed to ActiveCell.Offset(some number)? How much quicker is one than the other?

Thanks in advance!

  • 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-06-10T12:29:25+00:00Added an answer on June 10, 2026 at 12:29 pm

    Out of sheer boredom and a little curiosity I put together a crude timer for various methods to cycle 100,000 Excel cells.

    Ideally you should run each a number of times and take the average but it gives you a rough outline of speed.

    On my machine this is what I get

    enter image description here

    Option Explicit
    
    #If Win64 Then
        Public Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long
    #Else
        Public Declare Function GetTickCount Lib "kernel32" () As Long
    #End If
    
    Sub TestSpeedofReadingCells()
    Dim tcStart As Long
    Dim tcEnd As Long
    Dim temp As Variant
    
    Dim i As Long
    Dim rngobject As Range
    Dim rngItem As Range
    Dim rngArray() As Variant
    Const rowsToRead As Long = 100000
    
    
        '***Read individual cells using .Range
        With Sheet1
            tcStart = GetTickCount
            For i = 1 To rowsToRead
                temp = .Range("A" & i).Value
            Next i
            tcEnd = GetTickCount
            Debug.Print "Time1: " & tcEnd - tcStart
        End With
    
        '***Read individual cells using .Range & screenupdating off
        With Sheet1
            Application.ScreenUpdating = False
            tcStart = GetTickCount
            For i = 1 To rowsToRead
                temp = .Range("A" & i).Value
            Next i
            tcEnd = GetTickCount
            Application.ScreenUpdating = True
            Debug.Print "Time1a: " & tcEnd - tcStart
        End With
    
        '***Read individual cells using .Range & screenupdating off & using value2
        With Sheet1
            Application.ScreenUpdating = False
            tcStart = GetTickCount
            For i = 1 To rowsToRead
                temp = .Range("A" & i).Value2
            Next i
            tcEnd = GetTickCount
            Application.ScreenUpdating = True
            Debug.Print "Time1b: " & tcEnd - tcStart
        End With
    
        '***Read individual cells using range object
        With Sheet1
            Set rngobject = .Range("A1:A" & rowsToRead)
            tcStart = GetTickCount
            For Each rngItem In rngobject
                temp = rngItem
            Next rngItem
            tcEnd = GetTickCount
            Debug.Print "Time2: " & tcEnd - tcStart
        End With
    
        '***Read individual cells using activecell
        With Sheet1
            tcStart = GetTickCount
            .Range("A1").Select
            For i = 1 To rowsToRead
                temp = ActiveCell.Offset(i - 1, 0).Value
            Next i
            tcEnd = GetTickCount
            Debug.Print "Time3: " & tcEnd - tcStart
        End With
    
        '***Read individual cells using activecell & screenupdating off
        With Sheet1
            Application.ScreenUpdating = False
            tcStart = GetTickCount
            .Range("A1").Select
            For i = 1 To rowsToRead
                temp = ActiveCell.Offset(i - 1, 0).Value
            Next i
            tcEnd = GetTickCount
            Application.ScreenUpdating = True
            Debug.Print "Time3a: " & tcEnd - tcStart
        End With
    
        '***Read individual cells using array
        With Sheet1
            tcStart = GetTickCount
            rngArray = .Range("A1:A" & rowsToRead).Value
            For i = 1 To rowsToRead 'should really use Lbound to Ubound but only example
                temp = rngArray(i, 1)
            Next i
            tcEnd = GetTickCount
            Debug.Print "Time4: " & tcEnd - tcStart
        End With
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Summary: I am writing a macro that takes names from many different sheets in
Summary: exporting pixel data from NSOpenGLView to some file formats gives incorrect colours I
Summary : is there a way to get the unique lines from a file
Summary I am after some advice on the easiest way to analyze simple data
Summary Amazingly I could find nothing about this on Google or SO. When I
Summary: ASP.Net website with a couple hundred users. Data is exported to Excel files
Summary: I am pulling a list of user IDs from a members transaction table
Summary I have a web-application with more than 5 themes. Each themes covers a
Summary: I have a bunch of C functions I have to call from C#.
Summary: I want to save two classes of the same name and different namespaces

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.