C/C++教程

Excel Sheet排序

本文主要是介绍Excel Sheet排序,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Sub Sort_Sheets()
  Dim sCount As Integer, I As Integer, R As Integer
  ReDim Na(0) As String
  sCount = Sheets.Count
  For I = 1 To sCount
      ReDim Preserve Na(I) As String
      Na(I) = Sheets(I).Name
  Next
  For I = 1 To sCount - 1
      For R = I + 1 To sCount
          If Na(R) < Na(I) Then
             JH = Na(I)
             Na(I) = Na(R)
             Na(R) = JH
          End If
      Next
  Next
  For I = 1 To sCount
      Sheets(Na(I)).Move After:=Sheets(I)
  Next
End Sub
这篇关于Excel Sheet排序的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!