none
Grouping RRS feed

  • Question

  • Hi anyone,

    Can anyone interpret to me what is this coding about. The grouping of something?

    Sub Group(col)
    ' Group (0,0,0)= dummy
    ' Group (0,0,1)= total number of rows for parameter
    ' Group (0,0,2)= parameter normality p-value
    ' Group (0,0,3)= pooled sd
    ' Group (X,0,0)=groupReplicateNo X>=1
    ' Group (X,0,1++) = data value
    ' Group (X,1,0)=groupName X>=1
    ' Group (X,2,0)=parameterName X>=1
    ' Group (X,3,0)=Normality check p-value X>=1
    ' Group (X,4,0)=residual X>=1
    ' Group (X,1,1)= group mean
    ' Group (X,1,2)= group sdev

    Dim Group(100, 4, 10000) As String
    Dim GroupCount As Integer, current_cell As Object
    Dim next_cell As Object, workcell As Object
    Dim movin As Object
    Dim current_path As String

     

    Sheets("All").Activate
    CurrentGroup = "NULL"
    GroupCount = 0
    groupReplicateNo = 0
    Set current_cell = Range("B2")
    TotalRow = 0

     


    parameterName = current_cell.Offset(-1, col).Value
    Do While current_cell.Value <> ""
    TotalRow = TotalRow + 1

    groupname = current_cell.Offset(0, 0).Value


    If groupname <> CurrentGroup Then
           GroupCount = GroupCount + 1
           Group(GroupCount - 1, 0, 0) = groupReplicateNo
          
      
           groupReplicateNo = 0
          
           Group(GroupCount, 1, 0) = groupname
           Group(GroupCount, 2, 0) = parameterName
          
           'Debug.Print group(groupCount,0, 0)
           CurrentGroup = groupname
          
          
          
           ' Assign data value to array
            If current_cell.Offset(0, col).Value <> "" Then
            groupReplicateNo = groupReplicateNo + 1
           Group(GroupCount, 0, groupReplicateNo) = current_cell.Offset(0, col).Value
            End If
          
    Else
           If current_cell.Offset(0, col).Value <> "" Then
           groupReplicateNo = groupReplicateNo + 1
           Group(GroupCount, 0, groupReplicateNo) = current_cell.Offset(0, col).Value
           End If
              
    End If
    Set next_cell = current_cell.Offset(1, 0)
    Set current_cell = next_cell

    Loop

        Group(GroupCount, 0, 0) = groupReplicateNo

     

     

     

    Call ResidualCalc(Group, GroupCount)
    Call List(Group, GroupCount, col, TotalRow)

     

    ' Debug.Print "test"
    End Sub

    • Moved by Kee Poppy Wednesday, November 16, 2011 6:43 AM (From:Visual Basic General)
    Tuesday, November 15, 2011 1:41 AM

All replies

  • This code is scanning some cells on an Excel Worksheet and is reading from it some info about Goups info on that worksheet.

    Without seeing the worksheet, it is impossible to know what those groups represents

    Tuesday, November 15, 2011 4:15 AM
  • As soon as there is a Set used in the code, then the code is almost never for this forum (with is for VB in VSN) but for VBA (Visual Basic for Applications)

    The forum for that is

    http://social.msdn.microsoft.com/Forums/en-US/isvvba


    Success
    Cor
    Tuesday, November 15, 2011 5:57 AM