|
楼主 |
发表于 2010-12-9 20:47
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
这个程序只运行找到一条。
这个程序有的记录只找一条,有的记录可找多条,但一般都不能找全,为什么?
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 |
|