|
请帮忙解释以下代码!谢谢
Sub Inputtext()
Dim i As Integer
Dim b As Long
i = 10
b = 1
Sheets("数据").Select
Do Until ActiveSheet.Cells(b, 3) = ""
b = b + 1
Loop
Sheets("数据").Select
Do Until Sheets("单据").Cells(i, 4) = ""
Sheets("数据").Select
ActiveSheet.Cells(b, 1) = Sheets("单据").Cells(5, 6)
ActiveSheet.Cells(b, 2) = Sheets("单据").Cells(5, 4)
ActiveSheet.Cells(b, 3) = Sheets("单据").Cells(i, 4)
ActiveSheet.Cells(b, 4) = Sheets("单据").Cells(i, 5)
ActiveSheet.Cells(b, 5) = Sheets("单据").Cells(i, 6)
ActiveSheet.Cells(b, 6) = Sheets("单据").Cells(i, 7)
ActiveSheet.Cells(b, 7) = Sheets("单据").Cells(i, 8)
ActiveSheet.Cells(b, 8) = Sheets("单据").Cells(i, 9)
ActiveSheet.Cells(b, 9) = Sheets("单据").Cells(5, 9)
ActiveSheet.Cells(b, 10) = Sheets("单据").Cells(6, 4)
ActiveSheet.Cells(b, 11) = Sheets("单据").Cells(6, 6)
ActiveSheet.Cells(b, 12) = Sheets("单据").Cells(6, 9)
ActiveSheet.Cells(b, 13) = Sheets("单据").Cells(7, 4)
ActiveSheet.Cells(b, 14) = Sheets("单据").Cells(7, 6)
ActiveSheet.Cells(b, 15) = Sheets("单据").Cells(7, 9)
ActiveSheet.Cells(b, 16) = Sheets("单据").Cells(28, 4)
ActiveSheet.Cells(b, 17) = Sheets("单据").Cells(28, 6)
i = i + 1
b = b + 1
Loop
mmm
End Sub
Sub Outputtext()
Dim i As Integer
Dim b As Long
i = 6
b = 2
Sheets("数据").Select
Do Until ActiveSheet.Cells(b, 3) = ""
If Sheets("数据").Cells(b, 3) = Range("chbm").Value And Sheets("数据").Cells(b, 9) = Range("ckmc").Value And Sheets("数据").Cells(b, 1) >= Range("sdate").Value And Sheets("数据").Cells(b, 1) <= Range("edate").Value Then
Sheets("查询").Select
ActiveSheet.Cells(i, 1) = Sheets("数据").Cells(b, 1)
ActiveSheet.Cells(i, 2) = Sheets("数据").Cells(b, 2)
ActiveSheet.Cells(i, 3) = Sheets("数据").Cells(b, 9)
ActiveSheet.Cells(i, 4) = Sheets("数据").Cells(b, 8)
ActiveSheet.Cells(i, 5) = Sheets("数据").Cells(b, 9)
ActiveSheet.Cells(i, 6) = Sheets("数据").Cells(b, 10)
ActiveSheet.Cells(i, 7) = Sheets("数据").Cells(b, 8)
ActiveSheet.Cells(i, 8) = Sheets("数据").Cells(b, 12)
i = i + 1
End If
b = b + 1
Loop
Sheets("查询").Select
End Sub
Sub Search()
Dim i As Integer
Dim b As Long
i = 10
b = 2
Sheets("数据").Select
Do Until ActiveSheet.Cells(b, 2) = ""
If Sheets("数据").Cells(b, 2) = Val(cx.TextBox1.Text) Then
Sheets("单据").Select
ActiveSheet.Cells(i, 4) = Sheets("数据").Cells(b, 3)
ActiveSheet.Cells(i, 9) = Sheets("数据").Cells(b, 8)
ActiveSheet.Cells(5, 6) = Sheets("数据").Cells(b, 1)
ActiveSheet.Cells(5, 9) = Sheets("数据").Cells(b, 9)
ActiveSheet.Cells(6, 4) = Sheets("数据").Cells(b, 10)
ActiveSheet.Cells(6, 6) = Sheets("数据").Cells(b, 11)
ActiveSheet.Cells(6, 9) = Sheets("数据").Cells(b, 12)
ActiveSheet.Cells(7, 4) = Sheets("数据").Cells(b, 13)
ActiveSheet.Cells(28, 4) = Sheets("数据").Cells(b, 16)
ActiveSheet.Cells(28, 6) = Sheets("数据").Cells(b, 17)
ActiveSheet.Cells(5, 4) = Val(cx.TextBox1.Text)
i = i + 1
End If
b = b + 1
Loop
Sheets("单据").Select
End Sub
Sub Deltext()
Dim b As Long
b = 2
Sheets("数据").Select
Do Until ActiveSheet.Cells(b, 2) = ""
If Sheets("数据").Cells(b, 2) = Val(del.TextBox1.Text) Then
Sheets("数据").Rows(b).EntireRow.Delete: b = b - 1
End If
b = b + 1
Loop
Sheets("单据").Select
End Sub
Sub mmm()
Sheets("单据").Select
Range("d10:d25,i10:i25,d5:d7,f5:f6,i5:i6,d28,f28,i28").Select
Selection.ClearContents
Range("d5").Select
End Sub |
|