XL2000: ????? ??????? ????? Visual Basic ??? ?????? ??? ?? Excel

?????? ????????? ?????? ?????????
???? ???????: 213818 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

?? Microsoft Excel 2000 ???? ????? ????? ????? ???? ?? ????? ???????? Microsoft Visual Basic for Applications ???? ????? ?? ?????. ?????? ??? ??????? ????? ????????? ???????? ???? ????? ????????? ?? ??? ???????: ??? ??????? ? ??? ???????.

??????? ????

???? Microsoft ??????? ???????? ??? ??? ?? ???? ??????? ?? ?? ????? ? ? ?? ????? ??? ?????? ???????? ??????? ?/?? ???????? ???? ????. ????? ??? ??????? ??? ????? ??? ??? ??????? ???? ?? ????? ???????? ????????? ?????? ????????? ????????. ???? ?? ????? ??????? ????? Microsoft ??? ????? ????? ???? ???? ?? ?????? ?????? ??? ??????? ?????? ????? ?????? ?? ????? ??????? ?????? ????????? ???????.
??? ??? ??? ?? ???? ???? ???? ?????? ?? ???? ???????? ?? ????? ??? ??????? ????? Microsoft ?? ????? ???????. ????? ?? ?????????? ?? ?????? ????? ??? Microsoft ???:

Microsoft ????????? Partners ? https://partner.microsoft.com/global/30000104

????? Microsoft ??????? ???? ???? ??????? - http://support.microsoft.com/gp/advisoryservice

?????? ??? ???? ?? ????????? ??? ?????? ????? ???????? ???? ????? ??????? ????? Microsoft ?? ?????? ???? Microsoft ?????? ??? ?????: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

??????? 1: ??? ???????

??? ????? ?? "??? ???????" ??? ???? ?? ????? ??????? ? ??? ?? ???? ??? ????? ???? ?? "??? ???????" ??? ????? ????? ?? ????????.

?????? "??????? Sort ??" ???? ??? 1 ??? ??? n ?? ??????? ??? ???? ?????? ???? ?? 1 ??? n. ??? ?? ??? ??? ?????? n ? ????? ???? ???? n ??????. ?? ?? ?????? ???? ?????? ???? ?? 1 ??? n-1 ??, ??? ?? ??? ??? ?????? n-1, ????? ?????? ???? ?? ???? n-1. ??? ??? ???? ?????? ???? ?? 1 ??? n 2 ?? ??? ?? ??? ??? ?????? n-2 ? ????? ?????? ???? ?? ???? n-2 ?????.

??????? ???? "??? ???????" ?? ???? ??? ????? Visual Basic.
  1. ???? ?? ???? ??????? ?? ???? ???? ?????: Option Base 1
    Function SelectionSort(TempArray As Variant)
        Dim MaxVal As Variant
        Dim MaxIndex As Integer
        Dim i, j As Integer
    
        ' Step through the elements in the array starting with the
        ' last element in the array.
        For i = UBound(TempArray) To 1 Step -1
    
            ' Set MaxVal to the element in the array and save the
            ' index of this element as MaxIndex.
            MaxVal = TempArray(i)
            MaxIndex = i
    
            ' Loop through the remaining elements to see if any is
            ' larger than MaxVal. If it is then set this element
            ' to be the new MaxVal.
            For j = 1 To i
                If TempArray(j) > MaxVal Then
                    MaxVal = TempArray(j)
                    MaxIndex = j
                End If
            Next j
    
            ' If the index of the largest element is not i, then
            ' exchange this element with element i.
            If MaxIndex < i Then
                TempArray(MaxIndex) = TempArray(i)
                TempArray(i) = MaxVal
            End If
        Next i
    
    End Function
    
    Sub SelectionSortMyArray()
        Dim TheArray As Variant
    
        ' Create the array.
        TheArray = Array(15, 8, 11, 7, 33, 4, 46, 19, 20, 27, 43, 25, 36)
    
        ' Sort the Array and display the values in order.
        SelectionSort TheArray
        For i = 1 To UBound(TheArray)
            MsgBox TheArray(i)
        Next i
    
    End Sub
    					
  2. ?????? ??????? ???? ??? ??????? ????? ? ??? ??? ????? ? ?? ???? ??? ????? ???????.
  3. ??? ??????? SelectionSortMyArray ?? ???? ??? ?????.

??????? 2: ??? ???????

??? ??????? ?? ????? ???????? ?? "??? ???????" ???? ??? ?? ???? ??? ????? ???? ???? ???? ????? ?? ????? ???? ?? ????????.

?????? "????? ???????" ????? 1 n-1 ??????? ?? ?????? ????? ?????? ?? ???? ???? ???? (????? ???? ??? ?????? ???? 1 ???? 2 ? ??? ?????? ???? 2 ??? ???? 3 ?????). ??? ??? ??? ????? ???? ?? ?????? ??? ?? ??? ????? ??? ??????. ?????? ??? ??????? ??? ?? ???? ??? ?????? ????? ???? ?? ???????. ??????? ???? "??? ???????" ?? ???? ??? ????? Visual Basic.
  1. ???? ?? ???? ???????? ???????? ??????? ?? ???? ???? ?????: Option Base 1
    Function BubbleSort(TempArray As Variant)
        Dim Temp As Variant
        Dim i As Integer
        Dim NoExchanges As Integer
    
        ' Loop until no more "exchanges" are made.
        Do
            NoExchanges = True
    
            ' Loop through each element in the array.
            For i = 1 To UBound(TempArray) - 1
    
                ' If the element is greater than the element
                ' following it, exchange the two elements.
                If TempArray(i) > TempArray(i + 1) Then
                    NoExchanges = False
                    Temp = TempArray(i)
                    TempArray(i) = TempArray(i + 1)
                    TempArray(i + 1) = Temp
                End If
            Next i
        Loop While Not (NoExchanges)
    
    End Function
    
    Sub BubbleSortMyArray()
        Dim TheArray As Variant
    
        ' Create the array.
        TheArray = Array(15, 8, 11, 7, 33, 4, 46, 19, 20, 27, 43, 25, 36)
    
        ' Sort the Array and display the values in order.
        BubbleSort TheArray
        For i = 1 To UBound(TheArray)
            MsgBox TheArray(i)
        Next i
    End Sub
    					
  2. ?????? ??????? ???? ??? ??????? ????? ? ??? ??? ????? ? ?? ???? ??? ????? ???????.
  3. ??? ??????? SelectionSortMyArray ?? ???? ??? ?????.
??????: ?????? ??? ??????? ??? ?? ????? ??????. ?????? "??? ???????" ?? ????? ?????? ????? ">"???"<" ?? ????? ???????????? SelectionSort:
If TempArray(j) > MaxVal Then
				
???????? "??? ???????" ?? ????? ?????? ?????? ">" ??? "<" ?? ????? ?????????? BubbleSort:
If TempArray(i) > TempArray(i + 1) Then
				

???????

???? ???????: 213818 - ????? ??? ??????: 02/?? ??????/1427 - ??????: 3.5
????? ???
  • Microsoft Excel 2000 Standard Edition
????? ??????: 
kbmt kbdtacode kbhowto kbinfo kbprogramming KB213818 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????213818

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com