ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   variable counter/total (https://www.excelbanter.com/excel-programming/280009-variable-counter-total.html)

Carole

variable counter/total
 
I'm trying to count entries and amounts in 25 columns,
and want to pace the results in a "tot" work area: tot1 -
tot25. How can I use the counter as a variable?
j = 1
i = 1
Do Until j = 25
Do Until Cells(i, 2) = ""
"tot" & cells(j) = "tot" & cells(j) + 1
If Cells(i, 2) 119 Then
pt1 = pt1 + 2
Else
If Cells(i, 2) 79 Then
pt1 = pt1 + 1
Else
pt1 = pt1 + 0
End If
pt1 = pt1 + 0
End If
i = i + 1
Loop
j = j + 1
Loop

End Sub

Jase

variable counter/total
 
not sure if I read this properly, but would it be more
efficent to use sumif's and countif's (ie. the worksheet
functions)
-----Original Message-----
I'm trying to count entries and amounts in 25 columns,
and want to pace the results in a "tot" work area: tot1 -
tot25. How can I use the counter as a variable?
j = 1
i = 1
Do Until j = 25
Do Until Cells(i, 2) = ""
"tot" & cells(j) = "tot" & cells(j) + 1
If Cells(i, 2) 119 Then
pt1 = pt1 + 2
Else
If Cells(i, 2) 79 Then
pt1 = pt1 + 1
Else
pt1 = pt1 + 0
End If
pt1 = pt1 + 0
End If
i = i + 1
Loop
j = j + 1
Loop

End Sub
.



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

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