Solved

macro to refresh data in all 35 worksheets same work book

Posted on 2013-11-06
5
292 Views
Last Modified: 2013-11-07
Hi Experts
using Access and Excel 2003

I currently have an excel workbook with 35 sheets that are linked to different access qrys which I manually refresh each day.

I need a macro, so when the workbook is opened it automatically refreshes excel with the most current data from each of the qtys from ms access.

in each sheet row one is headers and then data from row 2 onwards.
0
Comment
Question by:route217
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
mikeyd234 earned 350 total points
Comment Utility
This should work:
Sub calcSheets()

  Dim WS_Count As Integer
  Dim I As Integer

  ' Set WS_Count equal to the number of worksheets in the active
  ' workbook.
  WS_Count = ActiveWorkbook.Worksheets.Count

  ' Begin the loop.
  For I = 1 To WS_Count

    ActiveWorkbook.Worksheets(I).EnableCalculation = False
    ActiveWorkbook.Worksheets(I).EnableCalculation = True

  Next I

End Sub

Open in new window

0
 
LVL 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 150 total points
Comment Utility
Hi,

pls try

Application.ScreenUpdating = False
ActiveWorkbook.RefreshAll
Application.ScreenUpdating = True

Open in new window

0
 
LVL 3

Expert Comment

by:mikeyd234
Comment Utility
Ignore my first post, use this one liner :)

ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources

Open in new window


You can add that into the workbook open event or into a sub :P

More info:
http://msdn.microsoft.com/en-us/library/office/ff195741.aspx
0
 

Author Comment

by:route217
Comment Utility
thinks for the feedback let me test.
0
 

Author Comment

by:route217
Comment Utility
Hi Experts

silly question if I have 7 worksheet s what line of code do I change to accommodate. .
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now