Advertisement
Guest User

Untitled

a guest
Aug 28th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Picture()
  2. Dim pictname As String
  3. Dim pastehere As Range
  4. Dim pasterow As Long
  5. Dim x As Long
  6. Dim lastrow As Long
  7. On Error Resume Next
  8. lastrow = Worksheets("Data").Range("C1").CurrentRegion.Rows.Count
  9. x = 2
  10. For x = 2 To 1000
  11. Set pastehere = Cells(x, 4)
  12. pasterow = pastehere.Row
  13. Cells(pasterow, 4).Select 'This is where picture will be inserted
  14.  
  15. pictname = Cells(x, 3) 'This is the picture name
  16. ActiveSheet.Pictures.Insert("C:\Users\berli\Downloads\barcodes\ean-13_" & pictname & ".png").Select 'Path to where pictures are stored
  17.  
  18. With Selection
  19.  
  20. .Left = Cells(pasterow, 1).Left
  21. .Top = Cells(pasterow, 1).Top
  22.  
  23. .ShapeRange.LockAspectRatio = msoTrue
  24. .ShapeRange.Height = 80#
  25. .ShapeRange.Width = 80#
  26. .ShapeRange.Rotation = 0#
  27. End With
  28.  
  29. Next
  30.  
  31. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement