Hey Guys,
I am new to posting so hopefully this is clear.
I am writing a macro in Excel 2010 that will copy a value from a list on one sheet and paste it into a pivot table filter in the next sheet. I need this to loop until it reaches the bottom of the list and the list will be different values each time. As I have it now, It will not continue after the first several I recorded and it is bringing the specific values into the code so when the values change it uses the original value in the code.
Any help would be awesome.
Sub Macro3()
'
' Macro3 Macro
'
'
Range("A5").Select
With ActiveSheet.PivotTables("PivotTable1").CubeFields( _
"[Item].[Global Material ID]")
.Orientation = xlRowField
.Position = 1
End With
Do Until ActiveCell = ""
Sheets("Supplier List").Select
ActiveCell.Range("A1,A1").Select
Application.CutCopyMode = False
ActiveCell.Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Item].[Global Material ID].[Global Material ID]").VisibleItemsList = Array( _
"[Item].[Global Material ID].&[GP00293707]")
Sheets("Supplier List").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Item].[Global Material ID].[Global Material ID]").VisibleItemsList = Array( _
"[Item].[Global Material ID].&[GP00293707]", _
"[Item].[Global Material ID].&[GP02824090]")
Sheets("Supplier List").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Item].[Global Material ID].[Global Material ID]").VisibleItemsList = Array("" _
, "", "[Item].[Global Material ID].&[GP02824211]", _
"[Item].[Global Material ID].&[GP00293707]", _
"[Item].[Global Material ID].&[GP02824090]")
Sheets("Supplier List").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Item].[Global Material ID].[Global Material ID]").VisibleItemsList = Array("" _
, "[Item].[Global Material ID].&[GP00514627]", "", _
"[Item].[Global Material ID].&[GP02824211]", _
"[Item].[Global Material ID].&[GP00293707]", _
"[Item].[Global Material ID].&[GP02824090]")
Sheets("Supplier List").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Item].[Global Material ID].[Global Material ID]").VisibleItemsList = Array("" _
, "[Item].[Global Material ID].&[GP00468272]", _
"[Item].[Global Material ID].&[GP00514627]", "", _
"[Item].[Global Material ID].&[GP02824211]", _
"[Item].[Global Material ID].&[GP00293707]", _
"[Item].[Global Material ID].&[GP02824090]")
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
End Sub
Bookmarks