|
代码供参考。。。- Sub Save4()
- '检验项目保存
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("Reference test items")
- r = .Cells(rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 1)
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- d(s) = ""
- Next
- End With
- With Sheets("FQC inspection")
- If .[f3] = "" Or .[e3] = "" Then
- MsgBox "The information is incomplete and cannot be saved!"
- Exit Sub
- End If
- st = CStr(.[f3].Value)
- If d.exists(st) Then
- MsgBox "产品型号和版本已重复"
- Exit Sub
- End If
- ReDim brr(1 To 26)
- brr(1) = .Range("f3").Value
- brr(2) = .Range("e3").Value
- brr(3) = .Range("a17").Value
- brr(4) = .Range("b17").Value
- brr(5) = .Range("c17").Value
- brr(6) = .Range("d17").Value
- brr(7) = .Range("e17").Value
- brr(8) = .Range("f17").Value
- brr(9) = .Range("g17").Value
- brr(10) = .Range("a19").Value
- brr(11) = .Range("b19").Value
- brr(12) = .Range("c19").Value
- brr(13) = .Range("d19").Value
- brr(16) = .Range("e19").Value
- brr(19) = .Range("f19").Value
- brr(20) = .Range("g19").Value
- brr(21) = .Range("a21").Value
- brr(22) = .Range("b21").Value
- brr(25) = .Range("c21").Value
- brr(26) = .Range("d21").Value
- End With
- With Sheets("Reference test items")
- r = .Cells(rows.Count, 1).End(3).Offset(1).Row
- For x = 1 To 26
- .Cells(r, x) = brr(x)
- Next
- End With
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|