+ Reply to Thread
Results 1 to 3 of 3

How to link images to cells, so that when filter is applied images will also get hidden.

Hybrid View

  1. #1
    Registered User
    Join Date
    10-31-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    11

    How to link images to cells, so that when filter is applied images will also get hidden.

    How to link images to cells, so that when filter is applied images will also get hidden along with corresponding cells.

    Thanks.

  2. #2
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: How to link images to cells, so that when filter is applied images will also get hidde

    You will need to name your images and maybe create a table - i then used
    =VLOOKUP(E3,PicTbl,1,0)
    to get the name of the image i wanted to appear and then used this code to call only that image to be placed in cell W50. I also named the images on the sheet which I didn't want to appear/disapper Bob so the code ignored them



    Private Sub Worksheet_Calculate()
        Dim oPic As Object
        Dim shpTemp As Shape
        Dim strName As String
            
         For Each shpTemp In Me.Shapes
            If shpTemp.Type = msoPicture Then
                If StrComp(Left(shpTemp.Name, 3), "BOB") = 0 Then
                    ' ignore Bob's!
                Else
                    shpTemp.Visible = False
                End If
            End If
        Next
        
        With Range("W50   ")
            strName = Trim(.Value)
            If Len(strName) > 0 Then
                Set oPic = Me.Pictures(strName)
                oPic.Visible = True
                oPic.Top = .Top
                oPic.Left = .Left
            End If
        End With
        
    End Sub
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

  3. #3
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: How to link images to cells, so that when filter is applied images will also get hidde

    You will need to name your images and maybe create a table - i then used
    =VLOOKUP(E3,PicTbl,1,0)
    to get the name of the image i wanted to appear and then used this code to call only that image to be placed in cell W50. I also named the images on the sheet which I didn't want to appear/disapper Bob so the code ignored them



    Private Sub Worksheet_Calculate()
        Dim oPic As Object
        Dim shpTemp As Shape
        Dim strName As String
            
         For Each shpTemp In Me.Shapes
            If shpTemp.Type = msoPicture Then
                If StrComp(Left(shpTemp.Name, 3), "BOB") = 0 Then
                    ' ignore Bob's!
                Else
                    shpTemp.Visible = False
                End If
            End If
        Next
        
        With Range("W50   ")
            strName = Trim(.Value)
            If Len(strName) > 0 Then
                Set oPic = Me.Pictures(strName)
                oPic.Visible = True
                oPic.Top = .Top
                oPic.Left = .Left
            End If
        End With
        
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 01-01-2014, 04:36 PM
  2. Replies: 2
    Last Post: 06-18-2013, 12:15 PM
  3. [SOLVED] Swap images depending on text in cell (vlookup for images??)
    By ld2x07 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-06-2013, 10:32 AM
  4. Replies: 0
    Last Post: 05-28-2008, 02:50 PM
  5. how can you link images to cells?
    By .: usman :. in forum Excel General
    Replies: 2
    Last Post: 12-12-2005, 03:50 PM

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