|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 录入()
Dim ar As Variant
Dim rn As Range
sfz = [c5]
mc = [c2] & "-" & [c5]
ar = Array([c2], [e2], [e3], [c4], [c5], [f4], [g2], [c3], [g3], [f5], [h5])
For i = 0 To UBound(ar)
If ar(i) = "" Then
m = m + 1
End If
Next i
If m <> "" Then MsgBox "请把信息录入完整!": Exit Sub
For Each shap In ActiveSheet.Shapes
Set Rng = shap.TopLeftCell
k = Rng.Address
If k = "$H$2" Then
shap.Copy
With ActiveSheet.ChartObjects.Add(0, 0, shap.Width, shap.Height + 5).Chart
Application.Wait Now + TimeValue("00:00:01")
.ChartArea.Select
.Paste
.Export ThisWorkbook.Path & "\照片\" & mc & ".jpg"
.Parent.Delete
End With
End If
Next shap
With Sheets("明细表")
r = .Cells(Rows.Count, 1).End(xlUp).Row + 1
Set rn = .Range("f1:f" & r).Find(sfz, , , , , , 1)
If Not rn Is Nothing Then MsgBox "身份证号重复,请核查后重试!": Exit Sub
.Cells(r, 2).Resize(1, 11) = ar
.Cells(r, 1) = r - 2
.Cells(r, 1).Resize(1, 12).Borders.LineStyle = 1
End With
MsgBox "保存成功!", 64, "提醒!"
End Sub
|
|