Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Picture()
- Dim pictname As String
- Dim pastehere As Range
- Dim pasterow As Long
- Dim x As Long
- Dim lastrow As Long
- On Error Resume Next
- lastrow = Worksheets("Data").Range("C1").CurrentRegion.Rows.Count
- x = 2
- For x = 2 To 1000
- Set pastehere = Cells(x, 4)
- pasterow = pastehere.Row
- Cells(pasterow, 4).Select 'This is where picture will be inserted
- pictname = Cells(x, 3) 'This is the picture name
- ActiveSheet.Pictures.Insert("C:\Users\berli\Downloads\barcodes\ean-13_" & pictname & ".png").Select 'Path to where pictures are stored
- With Selection
- .Left = Cells(pasterow, 1).Left
- .Top = Cells(pasterow, 1).Top
- .ShapeRange.LockAspectRatio = msoTrue
- .ShapeRange.Height = 80#
- .ShapeRange.Width = 80#
- .ShapeRange.Rotation = 0#
- End With
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement