Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Macro to refresh data

Hi All,

I have an Excel 'Data' sheet that gets data from Access query (DataImport
DataNew db query, then feeds data into 'Model' sheet that setup with
multiple formulas for analysis. Everything thus far works fine. I just need
to set up a macro to refresh the 'Data' sheet every time Access query gets
updated. Currently it refreshes when the user clicks on 'enable refresh when
workbook opens' but I would like to set up a button to do that because the
user might click on disable refresh....In addition to that I would like the
button/macro to refresh the 'Model' sheet with the new data as well.
It seems simple, but any direction will be greatly appreciated (Macro or VBA).

Thanks.
--
when u change the way u look @ things, the things u look at change.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Macro to refresh data

Sahafi, record a macro (Tools / Macros / Record New Macro) when you refresh
and that will give you the code & syntax for refreshing. Then you can call
that code whenever you want the data updated.

Bill


"sahafi" wrote:

Hi All,

I have an Excel 'Data' sheet that gets data from Access query (DataImport
DataNew db query, then feeds data into 'Model' sheet that setup with
multiple formulas for analysis. Everything thus far works fine. I just need
to set up a macro to refresh the 'Data' sheet every time Access query gets
updated. Currently it refreshes when the user clicks on 'enable refresh when
workbook opens' but I would like to set up a button to do that because the
user might click on disable refresh....In addition to that I would like the
button/macro to refresh the 'Model' sheet with the new data as well.
It seems simple, but any direction will be greatly appreciated (Macro or VBA).

Thanks.
--
when u change the way u look @ things, the things u look at change.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Macro to refresh data

Bill,

I have done that, but for some reason whenever I refresh the 'Data' sheet
the formulas on my 'Model' sheet turn into '#N/A'. Upon checking that I have
found that when I added a row of data to both of my tables in Access, the
query get updated, and Excel input the data correctly. The imported data goes
into 8 columns, plus I have 2 more columns (I and J) set up via a Vlookup
formulas (IF(ISNA(VLookup(---))). My original data up to row 1657, the new
row got inserted into row 1658, but on my I & J columns it shows on the
Vlookup as 1659 instead of 1658. So every time I do a refresh, I have to
change the corresponding criteria in my SUMPRODUCT formula to 1 less row
number to match the rest of the criteria on columns (A-H). How can I fix this?

Thanks.
--
when u change the way u look @ things, the things u look at change.


"Bill Pfister" wrote:

Sahafi, record a macro (Tools / Macros / Record New Macro) when you refresh
and that will give you the code & syntax for refreshing. Then you can call
that code whenever you want the data updated.

Bill


"sahafi" wrote:

Hi All,

I have an Excel 'Data' sheet that gets data from Access query (DataImport
DataNew db query, then feeds data into 'Model' sheet that setup with
multiple formulas for analysis. Everything thus far works fine. I just need
to set up a macro to refresh the 'Data' sheet every time Access query gets
updated. Currently it refreshes when the user clicks on 'enable refresh when
workbook opens' but I would like to set up a button to do that because the
user might click on disable refresh....In addition to that I would like the
button/macro to refresh the 'Model' sheet with the new data as well.
It seems simple, but any direction will be greatly appreciated (Macro or VBA).

Thanks.
--
when u change the way u look @ things, the things u look at change.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Macro to refresh data

You can use either the indirect or offset functions to maintain the proper
cell references. In most cases, Offset will be better. With offset, you
specify the first cell (the absolute reference) and then specify the number
of rows to count down or over. You can use the Row() function to determine
how many rows to offset (Row() - Row( first cell of data block) = row offset).





"sahafi" wrote:

Bill,

I have done that, but for some reason whenever I refresh the 'Data' sheet
the formulas on my 'Model' sheet turn into '#N/A'. Upon checking that I have
found that when I added a row of data to both of my tables in Access, the
query get updated, and Excel input the data correctly. The imported data goes
into 8 columns, plus I have 2 more columns (I and J) set up via a Vlookup
formulas (IF(ISNA(VLookup(---))). My original data up to row 1657, the new
row got inserted into row 1658, but on my I & J columns it shows on the
Vlookup as 1659 instead of 1658. So every time I do a refresh, I have to
change the corresponding criteria in my SUMPRODUCT formula to 1 less row
number to match the rest of the criteria on columns (A-H). How can I fix this?

Thanks.
--
when u change the way u look @ things, the things u look at change.


"Bill Pfister" wrote:

Sahafi, record a macro (Tools / Macros / Record New Macro) when you refresh
and that will give you the code & syntax for refreshing. Then you can call
that code whenever you want the data updated.

Bill


"sahafi" wrote:

Hi All,

I have an Excel 'Data' sheet that gets data from Access query (DataImport
DataNew db query, then feeds data into 'Model' sheet that setup with
multiple formulas for analysis. Everything thus far works fine. I just need
to set up a macro to refresh the 'Data' sheet every time Access query gets
updated. Currently it refreshes when the user clicks on 'enable refresh when
workbook opens' but I would like to set up a button to do that because the
user might click on disable refresh....In addition to that I would like the
button/macro to refresh the 'Model' sheet with the new data as well.
It seems simple, but any direction will be greatly appreciated (Macro or VBA).

Thanks.
--
when u change the way u look @ things, the things u look at change.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Open the Menu Data,Refresh Data,filename,import Bob Excel Programming 0 February 11th 06 04:51 PM
Macro to Refresh Data & Print cruwyser Excel Programming 1 February 1st 06 09:22 PM
Timing of automatic query refresh and macro pivot table refresh dutty Excel Programming 2 December 1st 04 07:19 PM
Run Macro on External Data Refresh John Witte Excel Programming 3 December 3rd 03 01:42 PM
Run Macro on External Data Refresh John Witte Excel Programming 0 December 3rd 03 12:49 AM


All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"