I apologize for posting this again. This is an update of an issue I posted yesterday. I forgot to add a tag to that post and Could not see how to update it.
Hope someone can help with this...it is beyond bizzare. I watched this several times now. n = the number of columns of data. When n=4, as t cycles through, section A is accessing section B to pull the data out of the spreadsheet. When t = 3....A1(3) returns as zero. Not ""...zero. The value of "a" strangely is the SAME as it was when t =2. The same thing happens to A2(3) and b. HOWEVER, A3(3) and c get the correct value. Now, when I whatch Section B, the value for FindData is correct when t=3 for each pull. It is not feeding back the value...WHY? It happens the same way EVERY time I run it.
Section A:
For t = 1 To n
DataCol = 11 + t
A1(t) = CInt(FindData("im_Count_TotalSession"))
a = CInt(FindData("im_Count_TotalSession"))
A2(t) = CInt(FindData("im_Count_AccSession"))
b = CInt(FindData("im_Count_AccSession"))
A3(t) = CInt(FindData("im_Count_RejSession"))
c = CInt(FindData("im_Count_RejSession"))
a1sum = a1sum + CInt(A1(t))
a2sum = a2sum + CInt(A2(t))
a3sum = a3sum + CInt(A3(t))
Section B:
Public Function FindData(Data As String) As String
Dim RowNum As Integer
Dim Count As Integer
On Error Resume Next
Set dataobj = ActiveWorkbook.ActiveSheet
If Data <> "" Then
'Looks in this array of cells for the desired item which is stored in "Data"
dataobj.Range(Cells(1, 4), Cells(1000, 4)).Find(Data, LookIn:=xlFormulas, LookAt:=xlWhole).Activate
If Err.Number = 0 Then
FindData = dataobj.Cells(ActiveCell.Row, DataCol).Value
Else
FindData = "???"
End If
Else
FindData = ""
d = Err.Number
End If
End Function
Hope someone can help with this...it is beyond bizzare. I watched this several times now. n = the number of columns of data. When n=4, as t cycles through, section A is accessing section B to pull the data out of the spreadsheet. When t = 3....A1(3) returns as zero. Not ""...zero. The value of "a" strangely is the SAME as it was when t =2. The same thing happens to A2(3) and b. HOWEVER, A3(3) and c get the correct value. Now, when I whatch Section B, the value for FindData is correct when t=3 for each pull. It is not feeding back the value...WHY? It happens the same way EVERY time I run it.
Section A:
For t = 1 To n
DataCol = 11 + t
A1(t) = CInt(FindData("im_Count_TotalSession"))
a = CInt(FindData("im_Count_TotalSession"))
A2(t) = CInt(FindData("im_Count_AccSession"))
b = CInt(FindData("im_Count_AccSession"))
A3(t) = CInt(FindData("im_Count_RejSession"))
c = CInt(FindData("im_Count_RejSession"))
a1sum = a1sum + CInt(A1(t))
a2sum = a2sum + CInt(A2(t))
a3sum = a3sum + CInt(A3(t))
Section B:
Public Function FindData(Data As String) As String
Dim RowNum As Integer
Dim Count As Integer
On Error Resume Next
Set dataobj = ActiveWorkbook.ActiveSheet
If Data <> "" Then
'Looks in this array of cells for the desired item which is stored in "Data"
dataobj.Range(Cells(1, 4), Cells(1000, 4)).Find(Data, LookIn:=xlFormulas, LookAt:=xlWhole).Activate
If Err.Number = 0 Then
FindData = dataobj.Cells(ActiveCell.Row, DataCol).Value
Else
FindData = "???"
End If
Else
FindData = ""
d = Err.Number
End If
End Function