ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   remove the row value in the pivot table creation code. (https://www.excelbanter.com/excel-programming/291568-remove-row-value-pivot-table-creation-code.html)

monika

remove the row value in the pivot table creation code.
 
Hi...

I want to remove the row value in the pivot table creation
code. Like in the
below code...I want to replace the H185 by the whatever
last row that should
be actually there. How can I find out the same while
creating the pivot
table.

range("H2").Select
ActiveCell.FormulaR1C1 = "PL"
range("H3").Select
ActiveCell.FormulaR1C1 = "=RC"
range("H3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]="""",R[-1]C,RC[-5])"
range("H3").Select
Selection.AutoFill Destination:=range("H3:H185"),
Type:=xlFillDefault
range("H3:H185").Select
Selection.NumberFormat = "0"

For creating the pivot table I used the macro.

Thanks
Monika


Tom Ogilvy

remove the row value in the pivot table creation code.
 
last row in column H

set rng = Cells(rows.count,8).End(xlup)
msgbox rng.row

--
Regards,
Tom Ogilvy

"monika" wrote in message
...
Hi...

I want to remove the row value in the pivot table creation
code. Like in the
below code...I want to replace the H185 by the whatever
last row that should
be actually there. How can I find out the same while
creating the pivot
table.

range("H2").Select
ActiveCell.FormulaR1C1 = "PL"
range("H3").Select
ActiveCell.FormulaR1C1 = "=RC"
range("H3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]="""",R[-1]C,RC[-5])"
range("H3").Select
Selection.AutoFill Destination:=range("H3:H185"),
Type:=xlFillDefault
range("H3:H185").Select
Selection.NumberFormat = "0"

For creating the pivot table I used the macro.

Thanks
Monika





All times are GMT +1. The time now is 10:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com