|
有一段宏,一按快捷键就报错;
运行时出错'1004'
类range的select方法无效.
进入basic调试时出现有一行错误,不知是什么原因,以下是程序原文:
Sub 打印开机单()
'
' p Macro
' PK1 记录的宏 2000-2-20
'
' 快捷键: Ctrl+p
'
If Date < DateValue("2005/05/01") Then
'COPY 格式
Sheets(2).Select
Cells.Select
Selection.Copy
Sheets(1).Select
Cells.Select
ActiveSheet.Paste
'输入单号
VC = InputBox(PROMPT:="请输入单号,此操作将生成开机单。。。。。。。。。。。请输入单号,此操作将生成开机单。。。。。。。。。。。请输入单号,此操作将生成开机单。。。。。。。。。。。。", Title:="请输入单号", Default:="D0")
'调用数据
' Worksheets(3).ACTIVE
Worksheets(3).Select
For B = 1 To 10000
If IsEmpty(Cells(B, 1)) * IsEmpty(Cells(B, 2)) * IsEmpty(Cells(B, 3)) * IsEmpty(Cells(B, 4)) Then
ta = B - 1
Exit For
End If
Next B
For i = 2 To ta
If Cells(i, 3) = VC Then
Worksheets(3).Cells(i, 1).Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
If Worksheets(3).Cells(i, 16) = "2" Then
Worksheets(1).Cells(31, 1) = "1.圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。"
ElseIf Worksheets(3).Cells(i, 16) = "圆" Then
Worksheets(1).Cells(31, 1) = "1.圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。"
ElseIf Worksheets(3).Cells(i, 16) = "圆筒" Then
Worksheets(1).Cells(31, 1) = "1.圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。"
ElseIf Worksheets(3).Cells(i, 16) = "圆筒。" Then
Worksheets(1).Cells(31, 1) = "1.圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。"
ElseIf Worksheets(3).Cells(i, 16) = "圆筒." Then
Worksheets(1).Cells(31, 1) = "1.圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。"
ElseIf Worksheets(3).Cells(i, 16) = "园" Then
Worksheets(1).Cells(31, 1) = "1.圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。"
ElseIf Worksheets(3).Cells(i, 16) = "园筒" Then
Worksheets(1).Cells(31, 1) = "1.圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。圆筒。"
Else
Worksheets(1).Cells(31, 1) = "1.抽开幅线。"
End If
If Worksheets(3).Cells(i, 17) = "2" Then
Worksheets(1).Cells(32, 1) = "2.自对办开机,附办。"
ElseIf Worksheets(3).Cells(i, 17) = "3" Then
Worksheets(1).Cells(32, 1) = "2.自对单开机。"
Else
Worksheets(1).Cells(32, 1) = "2.交工艺检查对单对办后开机。一定要对过业务部定货单。"
End If
If Worksheets(3).Cells(i, 1) = "S" Then
CMM = "单面机。"
ElseIf Worksheets(3).Cells(i, 1) = "D" Then
CMM = "双面机。"
ElseIf Worksheets(3).Cells(i, 1) = "R" Then
CMM = "罗纹机。"
ElseIf Worksheets(3).Cells(i, 1) = "T" Then
CMM = "双卫衣机。"
ElseIf Worksheets(3).Cells(i, 1) = "V" Then
CMM = "反包毛巾机。"
ElseIf Worksheets(3).Cells(i, 1) = "W" Then
CMM = "正包毛巾机。"
ElseIf Worksheets(3).Cells(i, 1) = "C" Then
CMM = "工业布机台。"
ElseIf Worksheets(3).Cells(i, 1) = "F" Then
CMM = "横机。"
ElseIf Worksheets(3).Cells(i, 1) = "H" Then
CMM = "144F单面机。"
ElseIf Worksheets(3).Cells(i, 1) = "A" Then
CMM = "自动间单面机。"
Else
CMM = "机。"
End If
Worksheets(1).Cells(3, 2) = Worksheets(3).Cells(i, 2)
Worksheets(1).Cells(4, 2) = Worksheets(3).Cells(i, 3)
Worksheets(1).Cells(5, 2) = Worksheets(3).Cells(i, |
|