excel vba 编程,针对语文数学英语三科,筛选出及格的科目并按照分数排序,如图。学习编程,再次向您请教

对编程有点兴趣,请您赐教代码,谢谢
2025-03-29 03:09:55
推荐回答(1个)
回答1:

Sub Test()
    dim i,j,k,t,s,arr(1 to 2, 1 to 3)
    i=2
    while cells(i,1)<>""
        'Make arr
        j=1
        for each k in array (2,4,6)
            arr(1,j)=cells(1,k)
            arr(2,j)=cells(i,k)
        next k
        'Sort arr
        for j=1 to 2
            for k=j+1 to 3
                if arr(2,k)                    for t=1 to 2
                        s=arr(t,k)
                        arr(t,k)=arr(t,j)
                        arr(y,j)=s
                    next t
                end if
            next k
        next i
        'delete <60
        for j=1 to 3
            if arr(2,j)<60 then arr(1,j)=""
        next j
        'save 
        cells(i,8)=arr(1,1) &" "& arr(1,2) &" "& arr(1,3)
        i=i+1
    wend
End Sub