各位大侠,我编了几个VBA的程序,可是有几个执行不了啦,有那位可以帮忙找原因?谢谢
程序如下:
Sub order_sheet()
'
' format_sheet Macro
' Macro recorded 2009-8-19 by xsl
'' Dim Csheet_index As Integer
Dim shtSheet As Worksheet
Dim shttSheet As Worksheet
Dim b As Integer
Csheet_index = Sheets("format").cells(1, 21) + 1
For i = 2 To Csheet_index
For Each shtSheet In Sheets
'b = 0
If shtSheet.Name = Sheets("format").cells(i, 20) Then
shtSheet.Move before:=Sheets(i + 1)
Sheets("format").Select
Sheets("format").cells(3, 21) = shtSheet.Name
Sheets("format").cells(2, 21) = Sheets(i + 2).Name
Sheets("format").cells(5, 21) = i
Sheets("format").cells(6, 21) = b
End If
Next
Next
End Sub
程序如下:
Sub order_sheet()
'
' format_sheet Macro
' Macro recorded 2009-8-19 by xsl
'' Dim Csheet_index As Integer
Dim shtSheet As Worksheet
Dim shttSheet As Worksheet
Dim b As Integer
Csheet_index = Sheets("format").cells(1, 21) + 1
For i = 2 To Csheet_index
For Each shtSheet In Sheets
'b = 0
If shtSheet.Name = Sheets("format").cells(i, 20) Then
shtSheet.Move before:=Sheets(i + 1)
Sheets("format").Select
Sheets("format").cells(3, 21) = shtSheet.Name
Sheets("format").cells(2, 21) = Sheets(i + 2).Name
Sheets("format").cells(5, 21) = i
Sheets("format").cells(6, 21) = b
End If
Next
Next
End Sub
cells(1,21) 的值为0,所以看不出已经执行了。鼠标点上去没有反映。
头一次进来,不知道如何给分。我是0分能给吗?谢谢