Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



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
Starting Auto_Close macro based on an IF statement questor Excel Discussion (Misc queries) 4 February 25th 08 10:22 PM
Getting macro to copy to starting cell sony654 Excel Worksheet Functions 3 February 4th 06 07:16 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Discussion (Misc queries) 1 March 9th 05 11:41 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Worksheet Functions 3 March 9th 05 11:40 PM
Verify starting cell for macro Don Cameron Excel Programming 3 September 6th 03 03:29 PM


All times are GMT +1. The time now is 09:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"