Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Seeting up repetitive code

I want to repeat this code:

ActiveSheet.PivotTables("PivotTable1").PivotFields ("Month").CurrentPage =

in multiple macros...how would I do it? This is my thought thus far but I'm
not sure about the syntax:

Dim repeat As String

repeat =
ActiveSheet.PivotTables("PivotTable1").PivotFields ("Month").CurrentPage = _


If Range("T6").Value = "2"
repeat&"January_2006"
end if

If Range("T6").Value = "3"
repeat&"February_2006"
end if


etc. etc. - any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Seeting up repetitive code

Maybe something like this?
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Month")
Select Case Range("T6")
Case 2
.CurrentPage = "January"
Case 3
.CurrentPage = "February"
Case Else
.CurrentPage = "Whatever"
End Select
End With
--
Charles Chickering

"A good example is twice the value of good advice."


"Matt" wrote:

I want to repeat this code:

ActiveSheet.PivotTables("PivotTable1").PivotFields ("Month").CurrentPage =

in multiple macros...how would I do it? This is my thought thus far but I'm
not sure about the syntax:

Dim repeat As String

repeat =
ActiveSheet.PivotTables("PivotTable1").PivotFields ("Month").CurrentPage = _


If Range("T6").Value = "2"
repeat&"January_2006"
end if

If Range("T6").Value = "3"
repeat&"February_2006"
end if


etc. etc. - any suggestions?

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
Repetitive Numbers Katelyn Excel Discussion (Misc queries) 1 February 19th 07 08:50 PM
Repetitive keystroke Andre Croteau Excel Discussion (Misc queries) 3 October 7th 06 02:20 AM
repetitive Repetitive formula Excel Discussion (Misc queries) 2 June 28th 06 05:59 AM
Repeat Code Repetitive Actions? chris Excel Discussion (Misc queries) 2 February 18th 05 11:30 PM
Need a simple VBA code to automate a repetitive task. madhu Excel Programming 2 January 21st 05 10:55 AM


All times are GMT +1. The time now is 12:20 AM.

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

About Us

"It's about Microsoft Excel"