Sub winnie()
Application.ScreenUpdating = False
'忽略错误提示
'On Error Resume Next
Dim MyFile As Object
Set MyFile = CreateObject("Scripting.FileSystemObject")
Dim i%, a%, Urow%, MaxNum%, InforAdd
Dim infor1(1 To 23)
Urow = Sheets("经济赔偿金明细表").Cells(Rows.Count, 1).End(xlUp).Row '统计非空工作区域最大行号
MaxNum = Sheets("经济赔偿金明细表").Cells(Urow, 1) '返回输入数据的最大值
InforAdd = [{"B","C","D","F","AG","AF","AE","K","L","M","N","0","P","Q","R","S","T","U","V","X","Y","Z","AB"}] '引用列编码
x = Sheets("确认表").Range("J4") '输入开始序号及位置
If x = Empty Or IsNumeric(Val(x)) <> True Or Val(x) < 1 Or Val(x) > MaxNum Then '开始序号的条件
MsgBox "开始序号输入错误"
GoTo 200
End If
Y = Sheets("确认表").Range("K4") '输入结束序号及位置
If Y = Empty Or IsNumeric(Val(Y)) <> True Or Val(Y) <= x Or Val(Y) > MaxNum Then '结束序号的条件
MsgBox "结束序号输入错误"
GoTo 200
End If
For i = x + 2 To Y + 2 Step 1
For a = 1 To UBound(InforAdd)
infor1(a) = Sheets("经济赔偿金明细表").Range(InforAdd(a) & i)
Next
Range("G1,B4,D4,G4,B5,D5,G5,B7:G7,B9:G9,C10,G10,C11,G11") = Application.Transpose(infor1)
|