![]() |
Starting a macro based on cell value
Hi, I build a report in Excel with a month-selector. What I want to achieve is that if a different month is selected the macro will be runned automatically. The macro will update two pivots using the commands below: ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh Tips are very welcome :) Thanx, Mike -- Le_requin ------------------------------------------------------------------------ Le_requin's Profile: http://www.excelforum.com/member.php...o&userid=14831 View this thread: http://www.excelforum.com/showthread...hreadid=264635 |
Starting a macro based on cell value
If you select a different month by changing a value in a cell (or selecting
a month from a validation dropdown in xl2000 or later) (assumes the pivot tables are on the same sheet as the cell with the month) Assume the cell is B9 Private Sub Worksheet_Change(ByVal Target As Range) if Target.count 1 then exit sub if isempty(target) then exit sub if Target.Address = "$B$9" then ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh End if End Sub -- Regards, Tom Ogilvy "Le_requin" wrote in message ... Hi, I build a report in Excel with a month-selector. What I want to achieve is that if a different month is selected the macro will be runned automatically. The macro will update two pivots using the commands below: ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh Tips are very welcome :) Thanx, Mike -- Le_requin ------------------------------------------------------------------------ Le_requin's Profile: http://www.excelforum.com/member.php...o&userid=14831 View this thread: http://www.excelforum.com/showthread...hreadid=264635 |
All times are GMT +1. The time now is 01:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com