G
Guest
To retrieve data from a pivot table the moment this table is changed I use
the code shown beneath. I thought it should work without problems, but it
does not. I really can't seem to figure this problem out!
I hope you can help me! Thanks in advance!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$20" Then
Sheets("INFO Dbase Uren").PivotTables("INFO Dbase Uren") _
.PivotFields("ARF No.").CurrentPage = Target.Value
Sheets("INFO Dbase Uren").Select
ActiveWindow.SmallScroll Down:=500
Range("A500").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.Offset(0, 200)).Select
Selection.Copy
Sheets.Add.Name = "TEMP"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("A20000").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.Offset(0, 200)).Select
Sheets("DBase Organic Planning").Select
Range("A1").Select
Selection.End(xlDown).Offset(3, 9).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End If
End Sub
the code shown beneath. I thought it should work without problems, but it
does not. I really can't seem to figure this problem out!
I hope you can help me! Thanks in advance!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$20" Then
Sheets("INFO Dbase Uren").PivotTables("INFO Dbase Uren") _
.PivotFields("ARF No.").CurrentPage = Target.Value
Sheets("INFO Dbase Uren").Select
ActiveWindow.SmallScroll Down:=500
Range("A500").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.Offset(0, 200)).Select
Selection.Copy
Sheets.Add.Name = "TEMP"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("A20000").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.Offset(0, 200)).Select
Sheets("DBase Organic Planning").Select
Range("A1").Select
Selection.End(xlDown).Offset(3, 9).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End If
End Sub