Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
the_clasik_ely
Femeie
24 ani
Hunedoara
cauta Barbat
24 - 80 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Add Picture Popup for a Cells in a Range Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
In order to add a popup image to each of the cells in selection, you can use Mr. Excel's code from this book he gives for free on his website:

His code adapted to my needs:

A code that skips cells that don't have an image for them, or cells that already have comments, and keeps adding comments to next cells in Selection:


Sub Picture_Popup_ActiveCell()
Application.ScreenUpdating = False

Dim wPath, ThisPicPath As String

For Each cell In Selection

    wPath = Application.ActiveWorkbook.Path & "\" ' path of all pictures
    ThisPicPath = ""
   
    Select Case cell.Offset(0, 3).Value
       
    Case "Steam"
        wPath = wPath & "OWNED Steam\" & cell.Offset(0, 8).Value & "\"
   
    Case "Epic Games"
        wPath = wPath & "OWNED Epic Games\" & cell.Offset(0, 8).Value & "\"
   
    Case "GOG"
        wPath = wPath & "OWNED GOG\" & cell.Offset(0, 8).Value & "\"
       
    Case "Ubisoft"
        wPath = wPath & "OWNED Ubisoft\" & cell.Offset(0, 8).Value & "\"
   
    End Select

    ThisPicPath = wPath & cell.Value & ".png" ' path to current cell's related png file
   
    If Dir(ThisPicPath) = "" Then ' if png file does not exist, try jpg
        ThisPicPath = wPath & cell.Value & ".jpg" ' path to current cell's related png file
    End If

    If Dir(ThisPicPath) = "" Then ' if png and jpg files do not exist
        GoTo ErrHandler_Skip_Cell: ' skip current cell
    Else
        If cell.Comment Is Nothing Then ' if cell doesn't already have a comment, add image popup
            With cell.AddComment
                .Shape.Fill.UserPicture ThisPicPath
                .Shape.Height = 300
                .Shape.Width = 500
            End With
        End If
    End If

ErrHandler_Skip_Cell:
Next cell

Application.ScreenUpdating = True
End Sub


Source:
https://www.youtube.com/watch?v=06LK92YY0gc


_______________________________________


pus acum 1 an
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
Add an image manually:

1. Right click on the desired cell and Insert comment

2. Delete the default text, then increase the size of the comment to the desired picture size

3. Right click the border of the comment - this is important, the border

4. Click Format comment

5. Click the Colors and Lines tab

6. Open the dropdown list under Color and click Fill Effects

7. Click on the Picture tab then Select Picture...

8. Click From a file and locate your picture and open it

9. Click Ok then Ok

Now you have a popup image for your cell

Source:
https://www.youtube.com/watch?v=uZU52uN6Qvg


_______________________________________


pus acum 1 an
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
updated code

_______________________________________


pus acum 1 an
   
Pagini: 1  

Mergi la