M
Miguel
Hi,
I have a created a macro that uses 3 digit zip codes, copy and paste it to
a pivot table and then copy and paste an estimated number for that specific
zip code. Then the macro does the same process, goes to the next zip code,
copy the zip code to the pivot table and then copy and paste the estimated
number. The problem is that the zip code does not get copy and paste into the
pivot table, it just takes whatever number is in there and estimate the
number that I want for all zip codes. Here's my code. Is there something
worng with it? The name of the worksheet where the zip code comes from is
"RVA", the pivot table is located in the "Census Type", the estimated number
is located in the "RVA" worksheet, and the name of the worksheet where the
number is gotten from is "Summary"
Sub Premium()
startrow = Sheets("RVA").Range("D2")
numrow = Sheets("RVA").Range("E2")
i = startrow
For i = startrow To numrow
Sheets("RVA").Select
Sheets("RVA").Rows(i + 3).Copy
ActiveSheet.Paste Destination:=Worksheets("RVA").Rows(1)
Sheets("Census Input").Select
Range("Q4").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
Application.Calculation = xlCalculationAutomatic
D24e1 = Sheets("Summary").Range("H19")
Sheets("RVA").Select
Sheets("RVA").Cells(i + 3, 7) = D24e1
Next i
End Sub
Thanks
I have a created a macro that uses 3 digit zip codes, copy and paste it to
a pivot table and then copy and paste an estimated number for that specific
zip code. Then the macro does the same process, goes to the next zip code,
copy the zip code to the pivot table and then copy and paste the estimated
number. The problem is that the zip code does not get copy and paste into the
pivot table, it just takes whatever number is in there and estimate the
number that I want for all zip codes. Here's my code. Is there something
worng with it? The name of the worksheet where the zip code comes from is
"RVA", the pivot table is located in the "Census Type", the estimated number
is located in the "RVA" worksheet, and the name of the worksheet where the
number is gotten from is "Summary"
Sub Premium()
startrow = Sheets("RVA").Range("D2")
numrow = Sheets("RVA").Range("E2")
i = startrow
For i = startrow To numrow
Sheets("RVA").Select
Sheets("RVA").Rows(i + 3).Copy
ActiveSheet.Paste Destination:=Worksheets("RVA").Rows(1)
Sheets("Census Input").Select
Range("Q4").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
Application.Calculation = xlCalculationAutomatic
D24e1 = Sheets("Summary").Range("H19")
Sheets("RVA").Select
Sheets("RVA").Cells(i + 3, 7) = D24e1
Next i
End Sub
Thanks