Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel macro as recorded. "Sheet1!R4C3:R50C5" needs to be made variable
when the input file changes,. thank you Sub Macro1() ' ' Macro1 Macro ' Macro recorded 10/5/2004 by lander11 ' ActiveWindow.LargeScroll ToRight:=1 Range("L:L,S:S,U:U").Select Range("U1").Activate Selection.Copy Workbooks.Add Template:="Workbook" Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Range("B5").Select Application.CutCopyMode = False Selection.EntireColumn.Insert Selection.EntireColumn.Insert Range("C4").Select ActiveCell.FormulaR1C1 = "mon" Range("C5").Select ActiveCell.FormulaR1C1 = "=MONTH(RC[-2])" Range("C5").Select Selection.AutoFill Destination:=Range("C5:C50") Range("C5:C50").Select Range("C5").Select ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "Sheet1!R4C3:R50C5").CreatePivotTable TableDestination:="", TableName:= _ "PivotTable1" ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1) ActiveSheet.Cells(3, 1).Select ActiveSheet.PivotTables("PivotTable1").SmallGrid = False ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:="CUST_CONC_CD", _ ColumnFields:="mon" With ActiveSheet.PivotTables("PivotTable1").PivotFields ("mon") .Orientation = xlDataField .Caption = "Count of mon" .Function = xlCount End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lookup Table - Variable Range | About this forum | |||
Entering Variable in a Pivot Table | Excel Discussion (Misc queries) | |||
Pivot table with a variable range in the sourcedata field | Excel Discussion (Misc queries) | |||
calendar control - pivot table input variable | Excel Programming | |||
Pivot Table - Object variable or with block variable not set? | Excel Programming |