fitzanna
11-03-2016, 12:37 PM
While (ActiveCell.Value > 0)
While (ActiveCell.Value > 0)
colTotal = colTotal + ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Offset(1, 0).Value = colTotal
avgSales = colTotal / Range("A" & Rows.Count).End(xlUp).Row
colTotal = 0
currentCol = currentCol + 1
ActiveSheet.Cells(firstRow, currentCol).Select
Wend
I'm trying to compute average sales for each column, without using the average function itself. I correctly get each column total but I fail to get the colTotal to divide by the number in each column. Is there something I'm doing wrong here? The part I highlighted is the problem I believe. Is my count function wrong? Any help would be appreciated.
While (ActiveCell.Value > 0)
colTotal = colTotal + ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Offset(1, 0).Value = colTotal
avgSales = colTotal / Range("A" & Rows.Count).End(xlUp).Row
colTotal = 0
currentCol = currentCol + 1
ActiveSheet.Cells(firstRow, currentCol).Select
Wend
I'm trying to compute average sales for each column, without using the average function itself. I correctly get each column total but I fail to get the colTotal to divide by the number in each column. Is there something I'm doing wrong here? The part I highlighted is the problem I believe. Is my count function wrong? Any help would be appreciated.