De92b
11-03-2023, 02:55 AM
Hello,
I'm new to VBA and am trying to set up a automatic RefreshAll upon changes in my worksheets.
My worksheets are linked to another workbook (A) and I would like to automatically refresh workbook B (which contains a query and pivot table) when there is data entered into workbook A. So far when data is entered into workbook A, the data is pulled into workbook B, however the query and pivot table don't update because my VBA code doesn't seem to work.
I entered the following in to the two worksheets in workbook B:
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.RefreshAll
End Sub
Do I need to enter any further code to enable the VBA or change any settings? (it is a macro-enabled workbook and VBA macro is allowed to run).
Thanks so much in advance!!
I'm new to VBA and am trying to set up a automatic RefreshAll upon changes in my worksheets.
My worksheets are linked to another workbook (A) and I would like to automatically refresh workbook B (which contains a query and pivot table) when there is data entered into workbook A. So far when data is entered into workbook A, the data is pulled into workbook B, however the query and pivot table don't update because my VBA code doesn't seem to work.
I entered the following in to the two worksheets in workbook B:
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.RefreshAll
End Sub
Do I need to enter any further code to enable the VBA or change any settings? (it is a macro-enabled workbook and VBA macro is allowed to run).
Thanks so much in advance!!