mgaria_sln
New Member
- Joined
- Mar 9, 2016
- Messages
- 7
I am attempting to apply xlTotalsCalculationSum to a range of cells in a table, but I cannot seem to get the range entered properly. Here is my current code.
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period2").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period3").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period4").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period5").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period6").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period7").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period8").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period9").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period10").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period11").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period12").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Total").TotalsCalculation = xlTotalsCalculationSum
How can I simplify this into one line of code?
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period2").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period3").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period4").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period5").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period6").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period7").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period8").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period9").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period10").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period11").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Period12").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("TenantIncome").ListColumns("Total").TotalsCalculation = xlTotalsCalculationSum
How can I simplify this into one line of code?