I have a sheet with employees numbers and names and I wanted to see the corresponding photo of each employee. I have a folder with the photos of each employee. Each filename is the employee's number. To be able to see the photos, I decided to put each photo inside a comment on each employee number cell. This way, when I pass over the employee number, a comment window will show up with the employee's photo. It will look like this:
Sub InsertPictures()
Dim cll As Range
Dim rng As Range
Dim strPath As String
strPath = "D:\Photo Folder"
With Sheets("Sheet1")
Set rng = Range("A2:A416")
End With
For Each cll In rng
If Dir$(strPath & "\" & cll.Value & ".jpg") <> "" Then
With cll
.ClearComments
.AddComment ("")
.Comment.Shape.Fill.UserPicture (strPath & "\" & cll.Value & ".jpg")
.Comment.Shape.Height = 160
.Comment.Shape.Width = 120
.Comment.Shape.LockAspectRatio = msoTrue
End With
End If
Next cll
End Sub
You can adjust the size of your photos by changing the Height (160) and Width (120).
7 comentários:
I can say its a life saving code
.Comment.Shape.Fill.UserPicture (strPath & "\" & cell.Value & ".jpg")
I am a excell rookie and i am getting an error on this line. Could please help me. I changed the source path for the photos and the range.
Thanks so much
Uday
Did you checked if your pictures extentions are .jpg or .jpeg?
I need some modification in this code. Pictures should be rotated 270 degree & then pasted in Cell comments. Please help. Thanks
I WANT EMPLOYEE PHOTO IN SEPARATE COLUMN
CAN U HELP ME OUT?...
dịch vụ kế toán thuế tại cầu giấy
dịch vụ kế toán thuế tại thanh xuân
dịch vụ kế toán thuế tại hà đông
dịch vụ kế toán thuế tại long biên
dịch vụ kế toán thuế tại tphcm
dịch vụ kế toán thuế tại bắc ninh
dịch vụ kế toán thuế tại đống đa
dịch vụ kế toán thuế tại tây hồ
dịch vụ kế toán thuế tại ba đình
dịch vụ kế toán thuế tại từ liêm
dịch vụ kế toán thuế tại hai bà trưng
dịch vụ kế toán thuế tại hoàng mai
dịch vụ kế toán thuế tại thanh trì
dịch vụ kế toán thuế tại quận 3
dịch vụ kế toán thuế tại quận thủ đức
dịch vụ kế toán thuế tại quận bình thạnh
dịch vụ kế toán thuế tại quận tân phú
dịch vụ kế toán thuế tại quận 12
dịch vụ kế toán thuế tại quận 11
dịch vụ kế toán thuế tại quận 10
dịch vụ kế toán thuế tại quận 9
dịch vụ kế toán thuế tại quận 8
dịch vụ kế toán thuế tại quận 7
dịch vụ kế toán thuế tại quận 6
dịch vụ kế toán thuế tại quận 5
dịch vụ kế toán thuế tại quận 4
dịch vụ kế toán thuế tại thái bình
Did you know that you can easily view the contents of your phone on your TV without a cable? With a screen mirror app you can easily do the screen mirroring from Android to TV. Check out www.screenmirroring.me to find out more.
Post a Comment