注册 登录
编程论坛 新人交流区

runtime erroe: 1004 application defined or object defined error

milkar 发布于 2007-10-19 07:11, 864 次点击
运行 下列程序段出现的错误:

Private Sub CommandButtonItem1_Click()
Dim item As Long
Dim rowInQuotationsheetBegin As Long
Dim rowInQuotationsheetEnd As Long

item = Worksheets("Sheet1").TextBoxItem1.Value


For i = 8 To 4000

If item = Worksheets("all").Cells(i, 6).Value Then
rowInQuotationsheetBegin = i
For j = i + 1 To i + 20

If Worksheets("all").Cells(j, 5).Value = "ITEM NO." Then
rowInQuotationsheetEnd = j - 1
Sheets("all").Select
Application.CutCopyMode = False
Rows("8:23").Select
'Rows([rowInQuotationsheetBegin : rowInQuotationsheetEnd]).Select
Selection.Copy
Sheets("QUOTATIONSHEET").Select
ActiveSheet.Paste
End If
Next j

End If

Next i

End Sub

还有我设了Dim rowInQuotationsheetBegin As Long
Dim rowInQuotationsheetEnd As Long来进行copy的动作但是rows或range要怎样应用变量名呢?

谢谢。
1 回复
#2
milkar2007-10-19 14:14
ding zi ding
1