View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
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?