Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
楼主: 徐海洋

[已解决]简历保存

[复制链接]
发表于 2022-5-9 22:32 | 显示全部楼层
本帖最后由 hasyh2008 于 2022-5-18 08:01 编辑

Private Sub Worksheet_Change(ByVal Target As Range)
  On Error Resume Next
  Dim Rg As Range
  Set Rg = Range("H2:H4")
  If Target.Address = "$C$5" Or Target.Address = "$C$2" Then
    删除图片
    ActiveSheet.Shapes.AddShape(msoShapeRectangle, Rg.Left, Rg.Top, Rg.Width, Rg.Height).Select
    Selection.ShapeRange.Fill.UserPicture ThisWorkbook.Path & "\图片\" & Cells(2, 3) & Cells(5, 3) & ".jpg"
  End If
  Set Rg = Nothing
End Sub

Private Sub CommandButton1_Click()
  On Error Resume Next
  Dim Arr(1 To 12), Brr, Shp As Shape
  Dim Dic
  Dim Rc%, K%
  Set Dic = CreateObject("scripting.dictionary")
  With Sheet1
   Arr(1) = .Cells(2, 3): Arr(2) = .Cells(2, 5): Arr(3) = .Cells(3, 5): Arr(4) = .Cells(4, 3)
   Arr(5) = .Cells(5, 3): Arr(7) = .Cells(4, 6): Arr(8) = .Cells(2, 7)
   Arr(9) = .Cells(3, 3): Arr(10) = .Cells(3, 7): Arr(11) = .Cells(5, 6): Arr(12) = .Cells(5, 8)
  End With
  For Each Shp In Sheet1.Shapes
    If Shp.Type <> 12 Then Shp.Copy
  Next Shp
  With Sheet2
    Rc = .Cells(Rows.Count, 2).End(xlUp).Row
    If Rc < 3 Then
      .Cells(3, 1) = 1
      .Cells(3, 2).Resize(1, 12) = Arr
      .ChartObjects.Add(.Range("G3").Left, .Range("G3").Top, .Range("G3").Width, .Range("G3").Height).Chart.Paste
    Else
      For K = 3 To Rc
        Dic(.Cells(K, 6).Text) = K
      Next K
      If Dic.Exists(Arr(5)) Then
        .Cells(Dic(Arr(5)), 2).Resize(1, 12) = Arr
      Else
        .Cells(Rc + 1, 1) = "=Counta($B$3:B" & Rc + 1 & ")"
        .Cells(Rc + 1, 2).Resize(1, 12) = Arr
        .ChartObjects.Add(.Cells(Rc + 1, 7).Left, .Cells(Rc + 1, 7).Top, .Cells(Rc + 1, 7).Width, .Cells(Rc + 1, 7).Height).Chart.Paste
      End If
    End If
  End With
End Sub


Sub 删除图片()
  Dim Shp As Shape
  For Each Shp In ActiveSheet.Shapes
    If Shp.Type <> 12 Then Shp.Delete
  Next Shp
End Sub


把图片存放在文件夹中,以姓名作为图片名称,格式为jpg格式,SHEET1中姓名发生变动时,自动填充图片。

简历保存(20220508).rar

47.05 KB, 下载次数: 2

回复

使用道具 举报

 楼主| 发表于 2022-5-10 09:11 | 显示全部楼层
本帖最后由 徐海洋 于 2022-5-10 09:41 编辑
hasyh2008 发表于 2022-5-9 22:32
Private Sub Worksheet_Change(ByVal Target As Range)
  On Error Resume Next
  Dim Rg As Range

谢谢您,尊师,照片这样做效果不好,如果有同名照片,怎么显示?删除行,序号不改变

回复

使用道具 举报

 楼主| 发表于 2022-5-10 09:33 | 显示全部楼层
本帖最后由 徐海洋 于 2022-5-10 09:34 编辑
hasyh2008 发表于 2022-5-9 22:32
Private Sub Worksheet_Change(ByVal Target As Range)
  On Error Resume Next
  Dim Rg As Range

谢谢老师,照片保存效果不好,删除行,序号不改变,
回复

使用道具 举报

发表于 2022-5-10 09:45 | 显示全部楼层
徐海洋 发表于 2022-5-10 09:11
谢谢您,尊师,照片这样做效果不好,如果有同名照片,怎么显示?删除行,序号不改变:kis ...

可以用姓名+身份证命名图片,这样就不会重复了!!
回复

使用道具 举报

 楼主| 发表于 2022-5-10 10:09 | 显示全部楼层
本帖最后由 徐海洋 于 2022-5-11 12:19 编辑
hasyh2008 发表于 2022-5-10 09:45
可以用姓名+身份证命名图片,

22.png
111.png
回复

使用道具 举报

发表于 2022-5-10 10:21 | 显示全部楼层
Private Sub Worksheet_Change(ByVal Target As Range)
  On Error Resume Next
  Dim Rg As Range
  Set Rg = Range("H2:H4")
  If Target.Address = "$C$5" Then
    删除图片
    ActiveSheet.Shapes.AddShape(msoShapeRectangle, Rg.Left, Rg.Top, Rg.Width, Rg.Height).Select
    Selection.ShapeRange.Fill.UserPicture ThisWorkbook.Path & "\图片\" & Cells(2, 3) & Cells(5, 3) & ".jpg"
  End If
  Set Rg = Nothing
End Sub
要先填写姓名,后填身份证号!
回复

使用道具 举报

 楼主| 发表于 2022-5-10 10:29 | 显示全部楼层
本帖最后由 徐海洋 于 2022-5-12 10:07 编辑



111.png
回复

使用道具 举报

 楼主| 发表于 2022-5-10 11:34 | 显示全部楼层
本帖最后由 徐海洋 于 2022-5-11 12:20 编辑


谢谢老师辛苦付出


简历保存.zip

118.54 KB, 下载次数: 3

回复

使用道具 举报

发表于 2022-5-10 13:26 | 显示全部楼层
本帖最后由 hasyh2008 于 2022-5-18 08:02 编辑

Private Sub Worksheet_Change(ByVal Target As Range)
  On Error Resume Next
  Dim Rg As Range
  Set Rg = Range("H2:H4")
  If Target.Address = "$C$5" Or Target.Address = "$C$2" Then
    删除图片
    ActiveSheet.Shapes.AddShape(msoShapeRectangle, Rg.Left, Rg.Top, Rg.Width, Rg.Height).Select
    Selection.ShapeRange.Fill.UserPicture ThisWorkbook.Path & "\图片\" & Cells(2, 3) & Cells(5, 3) & ".jpg"
  End If
  Set Rg = Nothing
End Sub

Private Sub CommandButton1_Click()
  On Error Resume Next
  Dim Arr(1 To 12), Brr, Shp As Shape
  Dim Dic
  Dim Rc%, K%
  Set Dic = CreateObject("scripting.dictionary")
  With Sheet1
   Arr(1) = .Cells(2, 3): Arr(2) = .Cells(2, 5): Arr(3) = .Cells(3, 5): Arr(4) = .Cells(4, 3)
   Arr(5) = .Cells(5, 3): Arr(7) = .Cells(4, 6): Arr(8) = .Cells(2, 7)
   Arr(9) = .Cells(3, 3): Arr(10) = .Cells(3, 7): Arr(11) = .Cells(5, 6): Arr(12) = .Cells(5, 8)
  End With
  For Each Shp In Sheet1.Shapes
    If Shp.Type <> 12 Then Shp.Copy
  Next Shp
  With Sheet2
    Rc = .Cells(Rows.Count, 2).End(xlUp).Row
    If Rc < 3 Then
      .Cells(3, 1) = 1
      .Cells(3, 2).Resize(1, 12) = Arr
      .ChartObjects.Add(.Range("G3").Left, .Range("G3").Top, .Range("G3").Width, .Range("G3").Height).Chart.Paste
    Else
      For K = 3 To Rc
        Dic(.Cells(K, 6).Text) = K
      Next K
      If Dic.Exists(Arr(5)) Then
        .Cells(Dic(Arr(5)), 2).Resize(1, 12) = Arr
      Else
        .Cells(Rc + 1, 1) = "=Counta($B$3:B" & Rc + 1 & ")"
        .Cells(Rc + 1, 2).Resize(1, 12) = Arr
        .ChartObjects.Add(.Cells(Rc + 1, 7).Left, .Cells(Rc + 1, 7).Top, .Cells(Rc + 1, 7).Width, .Cells(Rc + 1, 7).Height).Chart.Paste
      End If
    End If
  End With
End Sub


Sub 删除图片()
  Dim Shp As Shape
  For Each Shp In ActiveSheet.Shapes
    If Shp.Type <> 12 Then Shp.Delete
  Next Shp
End Sub
回复

使用道具 举报

 楼主| 发表于 2022-5-10 17:59 | 显示全部楼层
本帖最后由 徐海洋 于 2022-5-12 10:06 编辑


全好了,谢谢老师
25.png
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-24 23:15 , Processed in 1.028329 second(s), 8 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表