Forum Discussion

KathyK71's avatar
KathyK71
Copper Contributor
Jan 23, 2024

Inserting an image into a cell and have a toggle button?

Okay. I am really new and may not have the correct terminology but here goes. 

I am setting up an Excel spreadsheet for my cutting files for my crafting hobby. I am wanting a way to be able to use key words to find the correct file or files for what I want to work on. 

Here is the start of my spreadsheet:

So I have linked a path to the file number in the first column and now would like to add a picture of the finished product in the column after comments in the quickest and easiest way. My sister has the same spreadsheet for her files and her pictures are in a single cell but have a "button" that allows her to toggle between the picture in a cell and then over cells. Basically enlarging it to view it better. Then she can click the "button" again to put it back in the single cell. Here is a snip it of how hers looks:

You can see the "button" above the top right corner.  No matter what we have tried we cannot figure why she gets the "button" and I cannot.  

Please let me know what other information you may need to help. 

Thank you for your time.

 

4 Replies

  • peiyezhu's avatar
    peiyezhu
    Bronze Contributor
    No matter what we have tried we cannot figure why she gets the "button" and I cannot.


    Can your share a test file from your sister?
    • KathyK71's avatar
      KathyK71
      Copper Contributor
      I shared in my original a snippet of what it looks like. I could ask her to send email me a test file. She is working right now so it won't be until this evening.
  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    KathyK71 

    It looks like your sister is using the "Camera" tool in Excel, which allows you to create a dynamic link to a range of cells, and then you can toggle the display of that range with a button. Unfortunately, the "Camera" tool is not readily available in the ribbon in recent versions of Excel, but you can add it to your Quick Access Toolbar to make it accessible.

    Here is a step-by-step guide on how to use the Camera tool and add it to your Quick Access Toolbar:

    1. Adding the "Camera" Tool to the Quick Access Toolbar:

    1. Right-click on the ribbon and select "Customize the Ribbon."
    2. In the Excel Options window, choose "All Commands" from the "Choose commands from" drop-down list.
    3. Scroll down and find "Camera."
    4. Select "Camera" and click the "Add > >" button to add it to the Quick Access Toolbar.
    5. Click "OK" to close the Excel Options window.

    2. Using the Camera Tool:

    1. Select the range of cells (including the image) that you want to link to.
    2. Click on the "Camera" icon in the Quick Access Toolbar.
    3. Click on the cell where you want to place the linked image.
    4. The selected range is now linked to the cell, and any changes in the original range will be reflected in the linked image.

    3. Adding a Toggle Button:

    1. Go to the "Developer" tab. If you don't see the "Developer" tab, you can enable it in Excel Options.
    2. Click on "Insert" in the "Controls" group and choose a "Button" from the ActiveX Controls.
    3. Draw a button on your worksheet.
    4. Right-click on the button, select "Properties," and set the following properties:
      • Name: ToggleButton1 (or any other name)
      • Caption: Toggle
    1. Close the Properties window.
    2. Right-click on the button, choose "Format Control," and go to the "Control" tab.
    3. In the "Cell link" field, enter a cell reference (e.g., A1).
    4. Click "OK."
    5. Assign a macro to the button (right-click, "Assign Macro") and choose a macro that will toggle the visibility of your linked image range.

    Here is a simple VBA code for the toggle functionality:

    Sub ToggleImage()
        If Range("A1").Value = 1 Then
            Range("YourLinkedCell").Rows.Hidden = False
            Range("A1").Value = 0
        Else
            Range("YourLinkedCell").Rows.Hidden = True
            Range("A1").Value = 1
        End If
    End Sub

    Replace "YourLinkedCell" with the actual reference to your linked cell range.

    Now, when you click the button, it should toggle the visibility of your linked image range.

    The text, steps and code were created with the help of AI.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    Was the answer useful? Mark as best response and Like it!

    This will help all forum participants.

  • KathyK71's avatar
    KathyK71
    Copper Contributor
    Sorry, forgot to say I have Windows 11, Microsoft 365 Subscription, and my Excel version is: Version 2313 Build 16.017126.20132

Resources