+ Reply to Thread
Results 1 to 12 of 12

Insert Picture To Cell in Col A with pic name in Col B

Hybrid View

EBTI Insert Picture To Cell in Col... 02-24-2011, 10:24 PM
davesexcel Re: Insert Picture To Cell in... 02-25-2011, 05:11 AM
EBTI Re: Insert Picture To Cell in... 02-25-2011, 12:31 PM
EBTI Re: Insert Picture To Cell in... 02-25-2011, 12:56 PM
EBTI Re: Insert Picture To Cell in... 02-25-2011, 01:10 PM
e4excel Re: Insert Picture To Cell in... 02-26-2011, 03:28 AM
davesexcel Re: Conditional compilation... 02-26-2011, 08:24 AM
jolivanes Re: Insert Picture To Cell in... 02-26-2011, 04:51 PM
davesexcel Re: Insert Picture To Cell in... 02-27-2011, 09:31 AM
jolivanes Re: Insert Picture To Cell in... 02-27-2011, 02:01 PM
acraens Re: Insert Picture To Cell in... 06-03-2014, 02:55 PM
davesexcel Re: Insert Picture To Cell in... 06-07-2014, 07:57 AM
  1. #1
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Conditional compilation arguments vba

    Use this bit of code to get the list of jpg files in the folder, then that part of the error would be eliminated.
    Sub GetJPG()
    
        Dim y As Long
    
        Columns(2).ClearContents
        Range("B1") = "JPG Files"
        Application.ScreenUpdating = False
        
        With Application.FileSearch
    
            .LookIn = "C:\Documents and Settings\valued customer\My Documents\My Pictures\"    'Change to your location
            .FileType = msoFileTypeAllFiles
    
            For y = 1 To .FoundFiles.Count
    
                Sheet1.Cells(y + 1, 2) = Mid$(.FoundFiles(y), InStrRev(.FoundFiles(y), "\") + 1)
    
            Next
    
        End With
    
        OnlyJPG
    
    End Sub
    Sub OnlyJPG()
    'Filters just jpg files
        Dim Rws As Long, Rng As Range
    
        Rws = Cells(Rows.Count, "B").End(xlUp).Row
        Set Rng = Range(Cells(2, 2), Cells(Rws, 2))
    
        Rng.AutoFilter Field:=1, Criteria1:="<>*.JPG*", Operator:=xlAnd
        Rng.SpecialCells(xlCellTypeVisible).EntireRow.Delete
    
    End Sub
    .JPG will still remain in the file name so that part of your original code would not be required.
    Attached Files Attached Files
    Last edited by davesexcel; 02-26-2011 at 08:32 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1