首页->【软件工具包使用(SW/Software Tools Usage)】

19 1

Public Sub sortAndClass()
    
     Dim i As Long
     Dim j As Long
     Dim strTmp As String
     Dim strTmpPre As String
     
        i = 1
        j = 1
        Sheet11.Cells(1, 9).Value = 1
        With Sheet11
                .Activate
                strTmpPre = .Cells(1, 8).Value
                While strTmpPre <> ""
                        i = i + 1
                       strTmp = .Cells(i, 8).Value
                       
                       If strTmp = strTmpPre Then
                             j = j + 0
                     Else
                            j = j + 1
                       End If
                   .Cells(i, 9).Value = j
                   strTmpPre = strTmp
                Wend
        End With
        
        
End Sub

楼主可见

  1. shwnyoo 1#

    VBA基础应用之分数排序