megadentalda
New Member
- Joined
- Jan 30, 2017
- Messages
- 22
Please need some help with codign this last bit (bolded areas are the problem):
1st bold issue is that I need the cell value of "lastrowm" to be used in part of a formula. So if my cells are in column B then formula is C2/C20 if lastrowm is 20...
2nd bold issue is placement of a pivot table but again using value last rowm as this database changes constantly and need dynamic placement to keep it in same format.
any help greatly appreciated!!!
thank you in advance
Sheets("Results Table").Select
lastrowm = ActiveSheet.Range("A2").Offset.End(xlDown).Row
Range("B1:B" & lastrowm).Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.NumberFormat = "General"
Range("B1").Select
Range("B1").Value = "% per Rep"
For Each Cell In Range("B2:B" & lastrowm)
Cell.Value = "=rc[+1]/c & Lastrowm"
Next
Range("B2:B" & lastrowm).Select
Selection.Style = "Percent"
Sheets("Base de datos").Select
Range("F1").Value = "Ref"
Columns("E:K").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Base de datos!R1C5:R1048576C11", Version:=6).CreatePivotTable _
TableDestination:="Results Table!G & lastrowm + 6", TableName:="PivotTable2", _
DefaultVersion:=6
Sheets("Results Table").Select
Cells(G & lastrowm + 6).Select
With ActiveSheet.PivotTables("PivotTable2")
1st bold issue is that I need the cell value of "lastrowm" to be used in part of a formula. So if my cells are in column B then formula is C2/C20 if lastrowm is 20...
2nd bold issue is placement of a pivot table but again using value last rowm as this database changes constantly and need dynamic placement to keep it in same format.
any help greatly appreciated!!!
thank you in advance
Sheets("Results Table").Select
lastrowm = ActiveSheet.Range("A2").Offset.End(xlDown).Row
Range("B1:B" & lastrowm).Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.NumberFormat = "General"
Range("B1").Select
Range("B1").Value = "% per Rep"
For Each Cell In Range("B2:B" & lastrowm)
Cell.Value = "=rc[+1]/c & Lastrowm"
Next
Range("B2:B" & lastrowm).Select
Selection.Style = "Percent"
Sheets("Base de datos").Select
Range("F1").Value = "Ref"
Columns("E:K").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Base de datos!R1C5:R1048576C11", Version:=6).CreatePivotTable _
TableDestination:="Results Table!G & lastrowm + 6", TableName:="PivotTable2", _
DefaultVersion:=6
Sheets("Results Table").Select
Cells(G & lastrowm + 6).Select
With ActiveSheet.PivotTables("PivotTable2")