VB加进度条问题

PrivateSubCommand1_Click()DimoxlAsObjectDimowb1AsObject,owb2AsObject,owb3AsObjectDimo... Private Sub Command1_Click()
Dim oxl As Object
Dim owb1 As Object, owb2 As Object, owb3 As Object
Dim ost1 As Object, ost2 As Object, ost3 As Object
Dim i As Long, j As Long, k As Long, x As Long, y As Long, z As Long, l As Long
Set oxl = CreateObject("Excel.Application")
Set owb1 = oxl.Workbooks.Open(App.Path & "\1.xls")
Set ost1 = owb1.sheets("Sheet1")
Set owb2 = oxl.Workbooks.Open(App.Path & "\2.xls")
Set ost2 = owb2.sheets("Sheet1")
Set owb3 = oxl.Workbooks.Add
Set ost3 = owb3.sheets("Sheet1")
k = 1
x = Val(Text1.Text)
y = Val(Text2.Text)
z = Val(Text3.Text)
l = Val(Text4.Text)
For i = 1 To ost1.UsedRange.Rows.Count
For j = 1 To ost2.UsedRange.Rows.Count
DoEvents
If ost1.cells(i, x) = ost2.cells(j, y) Then
ost3.cells(k, 1) = ost1.cells(i, 1)
ost3.cells(k, 2) = ost1.cells(i, 2)
ost3.cells(k, 3) = ost1.cells(i, 3)
ost3.cells(k, 4) = ost1.cells(i, 4)
ost3.cells(k, z) = ost2.cells(j, l)
'ost3.cells(k, (y + 1)) = ost2.cells(j, (y + 1))
k = k + 1
Exit For
End If
Next
Next
owb3.saveas App.Path & "\3.xls"
owb3.Close
owb2.Close
owb1.Close
oxl.quit
MsgBox "OK"
这个用起来要好久,请问如何加个进度条来查看进度
展开
 我来答
syx54
推荐于2016-09-03 · TA获得超过7379个赞
知道大有可为答主
回答量:6567
采纳率:83%
帮助的人:2800万
展开全部
使用菜单,[工程]--[部件],勾选 Microsoft Windows Common Controls 6.0 (SP6),[确定]。
将进度条,添加到窗体。
在你的语句中合适位置增加4行代码,看看效果。

ProgressBar1.Min = 1 '增加的代码
ProgressBar1.Max = ost1.UsedRange.Rows.Count '增加的代码
ProgressBar1.Value = 0 '增加的代码

For i = 1 To ost1.UsedRange.Rows.Count
For j = 1 To ost2.UsedRange.Rows.Count
DoEvents
If ost1.cells(i, x) = ost2.cells(j, y) Then
ost3.cells(k, 1) = ost1.cells(i, 1)
ost3.cells(k, 2) = ost1.cells(i, 2)
ost3.cells(k, 3) = ost1.cells(i, 3)
ost3.cells(k, 4) = ost1.cells(i, 4)
ost3.cells(k, z) = ost2.cells(j, l)
'ost3.cells(k, (y + 1)) = ost2.cells(j, (y + 1))
k = k + 1
Exit For
End If
Next
ProgressBar1.Value = ProgressBar1.Value + 1 '增加的代码
Next
追问
大师出错了,不过我想要在后面加上百分之多少怎么加呢?
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2015-04-04
展开全部
一般的健脑的保健品没有明显的副作用,可以适当的用一些.但也不要指望着通过它们来提高记忆力,或者提高智力.它们的作用没有那么强.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式