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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:00:44+00:00 2026-05-16T09:00:44+00:00

I am Generating a New Sheets using macros. For a New Sheet generation ,

  • 0

I am Generating a New Sheets using macros. For a New Sheet generation , Data is retrieved from more than 4 MS Access DB. Each DB had minimum 200 field. My Macro code includes

  1. Cell locking
  2. Alignment and formatting
  3. One third of the cells in the sheet had a formulas
  4. Cell reference with other Workbooks

My problem is every sheet generation it takes minimum one hour to complete the hole process. But it seems to me it’s taking way too long.

I am already added the Application.ScreenUpdating = True to speed up the code but still it takes same time. How to do speed up the code , If you have any idea please guide me.

     `For Ip = 5 To  150
     resp = Range("B" & Ip).Value
     With ActiveSheet.QueryTables.Add(Connection:= _
    "ODBC;DSN=henkel2;DBQ=C:\Hl-RF\RSF-Temp.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;" _
    , Destination:=Range("IV4"))
    .CommandText = "select Vles from " & Shtname & " where cint(PrductID)='" & resp & "' and cint(DepotID) = '" & cnt1 & "' and Mnth = '" & mnths & "' and Type='" & typs & "'"
    .Name = "tab product"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .PreserveColumnInfo = True
    .SourceConnectionFile = _
    "C:\Hl-RF\tabct.odc"
    .Refresh BackgroundQuery:=False
    End With`


    Is There Is any way to Reduce the loop iteration time

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-05-16T09:00:44+00:00Added an answer on May 16, 2026 at 9:00 am

    There is some disucussion of this topic here.

    Edit:
    Ok, then the next step is to identify which parts of your code are taking the longest. The simplest way to do this is to make a copy of your code and just start measuring various parts like this:

    Private Declare Function GetTickCount Lib "kernel32.dll" () As Long
    Private mlngStrt As Long
    Private mlngEnd As Long
    
    Private Const u As Long = 10000000
    
    Public Sub Example()
        Dim i As Long
    
        mlngStrt = GetTickCount
        For i = 0 To u
        Next
        mlngEnd = GetTickCount
        Debug.Print "Section1", mlngEnd - mlngStrt
    
        mlngStrt = GetTickCount
        ExampleSubCall
        mlngEnd = GetTickCount
        Debug.Print "ExampleSubCall", mlngEnd - mlngStrt
    
        mlngStrt = GetTickCount
        For i = 0 To (u * 1.5)
        Next
        mlngEnd = GetTickCount
        Debug.Print "Section2", mlngEnd - mlngStrt
        Debug.Print "Example Complete"
    End Sub
    
    Private Sub ExampleSubCall()
        Dim i As Long
        For i = 0 To (u * 0.75)
        Next
    End Sub
    

    This approach is fairly straight-forward. The drawback here is that you need to insert all of the timing statements and then turn around and remove them. Which is why I would work on a copy.

    Once you know what parts are taking the longest you know where to focus your attention and what to ask for help with.

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

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It looks like the optional Java Media Framework is not… May 17, 2026 at 1:48 am
  • Editorial Team
    Editorial Team added an answer I guess there're 2 ways you can solve it: 1.… May 17, 2026 at 1:48 am
  • Editorial Team
    Editorial Team added an answer An old CGI trick would have been to encode the… May 17, 2026 at 1:48 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Should a highly dynamic website that is constantly generating new pages use a sitemap
I have a code that fetches a list from DB. Using that returned array
Using the right language for the job is the key - this is the
This part of my code was creating xls file successfuly FileOutputStream fileOut = new
Here's my problem - I'm trying to access a session namespace across actions .
I am using md5 to encrypt the passwords in my project. When user clicks
I am exporting a gridview to excel, using .Net 4.0 in a web application,
I am currently running numerous apply lines that look like this: test=data.frame(t=seq(1,5,1),e=seq(6,10,1)) mean(apply(test,2,mean)) I
I'm programming a game where a random map is generated whenever a new game
import java.util.*; import org.directwebremoting.util.Logger; public class People { public People() { people = new

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.