|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Public Sub 处理减少固定资产()
Dim i As Integer
Dim introw1 As Integer
Dim introw2 As Integer
ThisWorkbook.Activate
With Sheets("固定资产列表")
introw1 = .Range("L1").CurrentRegion.Rows.Count
Application.ScreenUpdating = False
For i = 2 To introw1
frmJtzj.Caption = "正在处理本月减少的固定资产数据"
If .Cells(i, 12) = "当月减少" Or .Cells(i, 12) = "当月新增并减少" Then
Sheets("固定资产列表").Select
Range(Cells(i, 1), Cells(i, 20)).Select
Selection.Copy
Sheets("固定资产流向").Select
introw2 = Sheets("固定资产流向").Range("A1").CurrentRegion.Rows.Count
Range(Cells(introw2 + 1, 1), Cells(introw2 + 1, 20)).Select
ActiveSheet.Paste
Sheets("固定资产列表").Select
Range(Cells(i, 1), Cells(i, 20)).EntireRow.Select
Selection.Delete Shift:=xlToLeft
Application.CutCopyMode = False
End If
frmJtzj.ProgressBar1.Value = Int(i / introw1 * 100)
Next
End With
Debug.Print i
Debug.Print introw1
End Sub
1.如上所述,想从一个表格复制数据到另一个表格;当IF条件满足时,执行复制条件。问题来了,执行一遍程序只能复制符合条件的几行数据,多按几遍F5才可以执行完;我的程序是在for循环写的,怎么会有这个问题呢!
|
|