Code kiểm tra hình trong thư mục-Cần hỗ trợ edit thêm

Liên hệ QC

MrKhoa3108

Thành viên mới
Tham gia
22/10/13
Bài viết
25
Được thích
4
Mã:
Sub LinkHinh()
    Dim pathFile, photo, FOLDER As String
    Dim cntRow As Double
    Dim fldr As FileDialog
    Dim photoCol As Integer
   
    Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
    With fldr
        .Title = "Select a Folder"
        .AllowMultiSelect = False
        If .Show <> -1 Then Exit Sub
        FOLDER = .SelectedItems(1)
    End With
   
   
    cntRow = 2
   
    Do While Cells(cntRow, 1).Value <> Empty
        photoCol = 5
        If Cells(cntRow, photoCol).Value = Empty Then
            'base on respondID
            photo = Dir(FOLDER & "\*" & Range("A" & CStr(cntRow)).Value & "*")
           
            Do While photo <> vbNullString
                pathFile = FOLDER & "\" & photo
                ActiveSheet.Hyperlinks.Add Cells(cntRow, photoCol), pathFile, , , "Photo"
                photo = Dir
                photoCol = photoCol + 1
            Loop
        End If
        cntRow = cntRow + 1
    Loop
    MsgBox "Done!!!"
End Sub
Chào mọi người, em có code trên là để kiểm tra số lượng ảnh theo file excel có sẳn là có bao nhiêu ảnh. Hiện tại code chạy OK, nhưng thay vì hiện chữ photo và hyperlink ở cell cần truy xuất ảnh thì em muốn nó xuất hẳn ra ảnh trên cell đó. Anh/Chị nào sửa giúp em với.
-Đính kèm file code và file anh để mọi người cùng thử
link ảnh mẫu : https://drive.google.com/file/d/1ijhQ509sdk2IulbtOPPACBDBCcOPAFiO/view?usp=sharing
 

File đính kèm

Web KT

Bài viết mới nhất

Back
Top Bottom