C
coleenholley
EEEK! I have eight columns and 18 rows in a table. I need to populate the table and run calculations on four of the columns andfor totals in a footer. Here is some of the code I am using to populate my table
Dim ls_county, ls_gas, ls_gasohol, ls_tot_gal, ls_cty_rate, ls_st_rate As Strin
Dim ls_sum_gas, ls_sum_gasohol, ls_sum_tot_gas, ls_sum_cty_tax, ls_sum_st_tax As Strin
Function calc_gallons(
I have to do this set of code for 17 rows! Any suggestion on how to do it easier? Can I do a for/Next loop? I need to make sure that the variables go into the correct column/row(cell) so I don't know that there is any way around doing code of this sort for all 8 columns and all 17 rows..
ls_gas = CInt(tbl_worksheet1.Rows(1).Cells(1).Text
ls_gasohol = CInt(tbl_worksheet1.Rows(1).Cells(2).Text
ls_tot_gal = CInt(ls_gas) + CInt(ls_gasohol
tbl_worksheet1.Rows(1).Cells(3).Text = ls_tot_ga
This set of code is only set to return the total for the first row into row 18 - I need to SUM all 17 rows for each column in the last row as overall totals... I'm terrible at For/Next - any suggestions
ls_sum_gas = CInt(ls_gas
tbl_worksheet1.Rows(18).Cells(1).Text() = ls_sum_ga
End Functio
Thanks - I need all the help I can get :-
Coleen
Dim ls_county, ls_gas, ls_gasohol, ls_tot_gal, ls_cty_rate, ls_st_rate As Strin
Dim ls_sum_gas, ls_sum_gasohol, ls_sum_tot_gas, ls_sum_cty_tax, ls_sum_st_tax As Strin
Function calc_gallons(
I have to do this set of code for 17 rows! Any suggestion on how to do it easier? Can I do a for/Next loop? I need to make sure that the variables go into the correct column/row(cell) so I don't know that there is any way around doing code of this sort for all 8 columns and all 17 rows..
ls_gas = CInt(tbl_worksheet1.Rows(1).Cells(1).Text
ls_gasohol = CInt(tbl_worksheet1.Rows(1).Cells(2).Text
ls_tot_gal = CInt(ls_gas) + CInt(ls_gasohol
tbl_worksheet1.Rows(1).Cells(3).Text = ls_tot_ga
This set of code is only set to return the total for the first row into row 18 - I need to SUM all 17 rows for each column in the last row as overall totals... I'm terrible at For/Next - any suggestions
ls_sum_gas = CInt(ls_gas
tbl_worksheet1.Rows(18).Cells(1).Text() = ls_sum_ga
End Functio
Thanks - I need all the help I can get :-
Coleen