[HELP] VBA ADD PICTURE

Copper Contributor

Help me, sorry, i want to add picture to excel file but now, i run code but picture not exactly size and position in page. I want to add picture at position A1:G16 and next A18:G33 and more add 17 unit....My code : (Please help me ) --------------------------------------------------------------------------------

Sub CHEN_HINH()
On Error Resume Next
Dim r As Long
Dim Pic As String
Dim i, j, k As Integer
i = 1
j = 16
k = 1

Application.ScreenUpdating = False
For r = 1 To 117
Pic = k & ".jpg"
ActiveSheet.Shapes("Pic").Delete
With ActiveSheet.Pictures.Insert(ThisWorkbook.Path & "\Picture\" & sitename & "\" & Pic)
.Name = Pic
.Width = Range(Cells(i, 1), Cells(j, 7)).Width
.Height = Range(Cells(i, 1), Cells(j, 7)).Height
.Top = Range(Cells(i, 1), Cells(j, 7)).Top
.Left = Range(Cells(i, 1), Cells(j, 7)).Left
End With
k = k + 1
i = i + 17
j = j + 17

Next
Application.ScreenUpdating = True
End Sub

0 Replies