Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Refresh Query if office 2007

I recently upgraded to office 2007.

I have a workbook that was setup to run a query whenever one of the
paramaters changes. Since I upgraded to 2007, the query does not refresh
until I click "refresh all". My parameters have not changes, and the check
box that says "refresh when cell A1 is changed" is still clicked. ...Am I
missing something?

What is the code to refresh all if cell A1 is changed?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Refresh Query if office 2007

Hi Todd,

When you upgraded to xl2007, did you also save the workbook as an xl2007 or
are you working in compatibility mode of the older version?

It sounds like the refresh was done as a result of a worksheet change event
and if you saved the workbook as xl2007, did you save it as an xlsm file that
allows macros or as an xlsx that does not allow macros? Whether in
compatibility mode or xlsm then you need to allow the macros.

To enable macros do the following. Needs to be done before you even open the
original old version of the workbook with the macros.

Click the big microsoft button top left of screen
Select Excel options (towards bottom right of dialog box)
Select Trust center (Left column)
Select Trust center settings (middle right of dialog box)
Select Macro Settings (Left column)
Select disable all with notification (This really means notify me each time
I open a worksheet with macros and let me choose whether to allow the macros
to run.)

If you have not done all of above then try that first.

Making an assumption that a macro runs when A1 is changed and the checkbox
is checked then the code would look something like this.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim isect As Object

If ActiveSheet.CheckBox1 = True Then
'Test if the changed cell is in a specific range
Set isect = Intersect(Target, Range("A1:A10"))
If Not isect Is Nothing Then 'Cell is in range
ActiveWorkbook.RefreshAll
End If
End If

End Sub

You right Click the Sheet name tab and select View Code and if the code is
not there than you could copy the above code and paste it in to the VBA
editor and then close the VBA editor and save the workbook as .xlsm type.
However, I do not know exactly what it is you need so it will require some
more editing to achieve the desired results.

--
Regards,

OssieMac


"ToddEZ" wrote:

I recently upgraded to office 2007.

I have a workbook that was setup to run a query whenever one of the
paramaters changes. Since I upgraded to 2007, the query does not refresh
until I click "refresh all". My parameters have not changes, and the check
box that says "refresh when cell A1 is changed" is still clicked. ...Am I
missing something?

What is the code to refresh all if cell A1 is changed?

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
Refresh background query in Excel 2007 F Jones Excel Programming 0 May 1st 08 11:34 AM
Excel 2007 vba - Refresh after web query? Rui Brito Excel Programming 1 February 27th 08 03:35 AM
Unable to open files after installing Office 2007 refresh !!! rkisling Excel Discussion (Misc queries) 2 October 5th 06 02:43 AM
Timing of automatic query refresh and macro pivot table refresh dutty Excel Programming 2 December 1st 04 07:19 PM
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) Anant[_2_] Excel Programming 1 August 6th 03 04:22 AM


All times are GMT +1. The time now is 08:29 PM.

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"