reportingbuzz
MIS
Hi,
While looping through a column from 2 to 12, I want to see those cells which has some value, and do a count of those cells which has the value.
How can I do that?
Thanks.
There are 3 cells with data. When I do the above, I see 3 alert boxes but the 3rd time, I see a wrong count of 4
1st alert - 1: PlanName
2nd alert - 2: PlanName
3rd alert - 4: PlanName
The code that shows the above alert boxes is:
Where is this 4 coming from? Any ideas?
2ndly, how can I can count of non-empty cells? My count here returns the total number of columns I am leaping through.
Thanks.
While looping through a column from 2 to 12, I want to see those cells which has some value, and do a count of those cells which has the value.
How can I do that?
Thanks.
Code:
With wSht
For iRow = 2 To 105
'grab the value of the 'AiRow'
'varPlan = .Cells(iRow, 1).Value
varPlan = "Channel Manager"
'Loop through the columns to get the components
'Count the number of components and insert that many
'rows for the Plan
Count = 1
For iColumn = 2 To 12
varComponent = .Cells(iRow, iColumn)
If Not IsEmpty(varComponent) Then
MsgBox (Count & ": " & varComponent)
'getPlanUI (varPlan)
'getPlanComponentUI (varComponent)
End If
Count = Count + 1
Next
[b] 'This returns the total number of columns
'how to get the count of non-empty cells?[/b]
MsgBox (Count)
Exit For
Next
End With
There are 3 cells with data. When I do the above, I see 3 alert boxes but the 3rd time, I see a wrong count of 4
1st alert - 1: PlanName
2nd alert - 2: PlanName
3rd alert - 4: PlanName
The code that shows the above alert boxes is:
Code:
MsgBox (Count & ": " & varComponent)
Where is this 4 coming from? Any ideas?
2ndly, how can I can count of non-empty cells? My count here returns the total number of columns I am leaping through.
Thanks.