ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   marco after selection in PV table (https://www.excelbanter.com/excel-programming/329221-marco-after-selection-pv-table.html)

Dennis Cheung[_2_]

marco after selection in PV table
 
can i build a marco to run automatically after making a selection of field
in pivot table?

dennis



Carim[_3_]

marco after selection in PV table
 
Dennis,

Quite simply ... use

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Run ("TheNameofYourMacro")
Application.EnableEvents = True
End Sub

HTH
Carim


Dennis Cheung[_2_]

marco after selection in PV table
 
Dear Carim,

i save the code in sheet1, my table is in sheet1. but the marco didn't run.
can u help again?

Dennis

"Carim" wrote in message
ups.com...
Dennis,

Quite simply ... use

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Run ("TheNameofYourMacro")
Application.EnableEvents = True
End Sub

HTH
Carim




Carim[_3_]

marco after selection in PV table
 
Dennis,

Just type =Now() in any cell of your sheet1 ...

HTH

Carim


Dennis Cheung[_2_]

marco after selection in PV table
 
Carim,

i am sorry that it didn't work as i follow your instruction. do i miss
anything or did something wrong?

Dennis

dennis
"Carim" wrote in message
ps.com...
Dennis,

Just type =Now() in any cell of your sheet1 ...

HTH

Carim




Carim[_3_]

marco after selection in PV table
 
Because the pivot table is an object, its refresh does not trigger a
worksheet calculate event, therefore you need a volatile function such
as now() or any function linked to the result of your pivot table being
recalculated such as
=MATCH("Grand Total",A:A,1) to fire the event...

HTH

Carim


Dennis Cheung[_2_]

marco after selection in PV table
 
Dear Carim,

I tried your formula but the Marco did'nt run. Can you explain more
specific? I am not familar to VBA. Thanks again!

Dennis

"Carim" wrote in message
ups.com...
Because the pivot table is an object, its refresh does not trigger a
worksheet calculate event, therefore you need a volatile function such
as now() or any function linked to the result of your pivot table being
recalculated such as
=MATCH("Grand Total",A:A,1) to fire the event...

HTH

Carim




Carim[_3_]

marco after selection in PV table
 
Dennis,

Make sure your Excel is set with automatic calculation ...
Tools Option Calculation Automatic

Otherwise, I am sorry I cannot help you out anymore ...

HTH

Carim


Dennis Cheung[_2_]

marco after selection in PV table
 
it works now. thanks. but i didn't change any of the setting in my excel. ??

Dennis

"Carim" wrote in message
oups.com...
Dennis,

Make sure your Excel is set with automatic calculation ...
Tools Option Calculation Automatic

Otherwise, I am sorry I cannot help you out anymore ...

HTH

Carim




Carim[_3_]

marco after selection in PV table
 
Glad it is working ...
and glad I could help

Cheers
Carim



All times are GMT +1. The time now is 10:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com