Skip to main content

Excel 圖片:在 Excel 中插入、調整大小、保存、刪除多個圖片

Author: Xiaoyang Last Modified: 2025-08-06

無論您需要從電腦、網路或 OneDrive 插入圖片,還是將它們鎖定到特定單元格,本指南都提供了全面的解決方案。您還將學習如何根據單元格值動態顯示圖片、調整和對齊多個圖片、將圖片嵌入到批註或頁首中,以及創建動態圖片下拉列表。對於更高級的任務,例如匯出、重命名、浮動或從特定範圍或工作表中刪除圖片,逐步指導將引導您完成每個過程。

目錄:

1. 從電腦、網路或 OneDrive 插入圖片到工作表

2. 將圖片鎖定到 Excel 單元格中

3. 在 Excel 中插入多個圖片

4. 插入多個與名稱匹配的圖片到單元格

5. 從網址插入或顯示圖片

6. 從檔案路徑插入或顯示圖片

7. 將圖片插入到批註中

8. 將圖片插入到頁首或頁尾中

9. 將相同的圖片插入到多個工作表中

10. 將圖片插入到單元格內容後面

11. 將一範圍的單元格插入為 Excel 中的圖片格式

12. 根據單元格值動態插入圖片

13. 從 Excel 文件中匯出或保存所有圖片

14. 根據 Excel 中的單元格列表重命名文件夾中的圖片名稱

15. 點擊圖片時放大或縮小

16. 滾動工作表時始終浮動圖片

17. 從當前工作表/一範圍的單元格中刪除圖片


從電腦、網路或 OneDrive 插入圖片到工作表

所有 Excel版本都支持從電腦插入圖片,但如果您想從網路或 OneDrive 插入圖片,您應該擁有 Excel2013及更高版本。

從電腦插入圖片

對於大多數人來說,將存儲在電腦上的圖片插入到工作表中是很容易的。請按以下步驟操作:

1. 在工作表中,點擊您想要插入圖片的位置。

2. 然後,點擊插入 > 圖片 > 此設備,見截圖:

A screenshot of the Insert Pictures option in Excel for adding images from a device

3. 在彈出的插入圖片窗口中,打開包含圖片的文件夾,然後按住 Ctrl 鍵選擇您想要插入的圖片,見截圖:

A screenshot of selecting images in the Insert Picture dialog box in Excel

4. 然後,點擊插入按鈕,選定的圖片已插入到工作表中。現在,您可以調整或更改圖片的大小以適應您需要的單元格,見截圖:

A screenshot of pictures inserted into an Excel worksheet


從網路或 OneDrive 插入圖片

如果您擁有 Excel2013 或更高版本,您可以從網路或 OneDrive 插入圖片,請按以下步驟操作:

1. 在工作表中,點擊您想要插入圖片的位置。

2. 然後,點擊插入 > 圖片 > 在線圖片,見截圖:

A screenshot of the Online Pictures option in Excel under the Insert tab

3. 將顯示以下窗口。在在線圖片部分,請在文本框中輸入您要查找的內容,然後按 Enter 鍵。所有相應的圖片會立即被搜索到,見截圖:

A screenshot of the Online Pictures search results in Excel

4. 然後,選擇您想要的圖片,然後點擊插入按鈕。插入圖片後,請調整或更改圖片到您需要的位置。

提示:

1. 要搜索一些特定的圖片,您可以根據需要按大小、類型、佈局或顏色篩選找到的圖片。

A screenshot showing filters for image search results in Excel's Online Pictures feature

2. 除了從 Bing 搜索中插入圖片,您還可以插入存儲在 OneDrive 上的圖片。在下面的窗口中,點擊窗口左下角的 OneDrive,然後選擇您想要插入的圖片。

A screenshot showing the OneDrive option for inserting images into Excel


將圖片鎖定到 Excel 單元格中

通常,在將圖片插入到單元格後,當您調整大小、篩選或隱藏包含圖片的單元格時,圖片不會隨著該單元格一起調整大小或篩選,如下演示所示。

A demonstration of images not resizing or filtering with cells in Excel

在這種情況下,您應該將圖片鎖定到單元格中,以便它可以隨著單元格一起調整大小、篩選或隱藏,請按照以下步驟操作:

1. 點擊選擇一張圖片,然後按 Ctrl + A 選擇工作表中的所有圖片。

2. 然後,右鍵單擊一張圖片,從上下文菜單中選擇大小和屬性,見截圖:

A screenshot showing the Size and Properties option for images in Excel

3. 在展開的格式圖片窗格中,屬性部分下,選擇隨單元格移動和大小選項,見截圖:

A screenshot of the Format Picture pane with the Move and size with cells option selected

4. 然後,關閉格式圖片窗格。現在,當調整大小、篩選或隱藏單元格時,圖片也會被移動、篩選或隱藏。


在 Excel 中插入多個圖片

有時,您可能需要將多個圖片插入到單元格中並自動調整大小以適應單元格大小,而無需手動調整和拖動圖片。這裡,我將介紹兩種方法來解決這個問題。

使用 VBA代碼插入多個圖片並調整大小以適應單元格

以下 VBA代碼可以幫助您根據單元格大小插入多個圖片。請按以下步驟操作:

1. 調整您想要放置圖片的單元格大小,然後選擇單元格。

2. 然後,按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

3. 點擊插入 > 模塊,然後將以下宏粘貼到模塊窗口中。

VBA代碼:根據單元格大小插入多個圖片

Sub InsertPictures()
'Updateby Extendoffice
Dim PicList() As Variant
Dim PicFormat As String
Dim Rng As Range
Dim sShape As Shape
On Error Resume Next
PicList = Application.GetOpenFilename(PicFormat, MultiSelect:=True)
xColIndex = Application.ActiveCell.Column
If IsArray(PicList) Then
    xRowIndex = Application.ActiveCell.Row
    For lLoop = LBound(PicList) To UBound(PicList)
        Set Rng = Cells(xRowIndex, xColIndex)
        Set sShape = ActiveSheet.Shapes.AddPicture(PicList(lLoop), msoFalse, msoCTrue, Rng.Left, Rng.Top, Rng.Width, Rng.Height)
        xRowIndex = xRowIndex + 1
    Next
End If
End Sub

4. 然後按 F5 鍵運行此代碼。在打開的窗口中,請選擇包含圖片的文件夾,然後選擇您想要插入的圖片,然後點擊 打開按鈕,所有選定的圖片已根據單元格大小插入到您的選擇中。見截圖:

A screenshot of multiple images inserted into cells based on cell size in Excel


使用強大功能插入多個圖片並調整大小以適應單元格

如果您不熟悉 VBA代碼,這裡您可以使用 Kutools for Excel 的強大功能——導入圖片。使用此實用功能,您可以快速輕鬆地將多個圖片導入到單元格中。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 點擊 Kutools Plus > 導入 & 匯出 > 導入圖片,見截圖:

A screenshot of the Import Pictures option in Kutools tab in Excel

2. 在彈出的導入圖片對話框中,請執行以下操作:

  • 從導入順序下拉列表中指定圖片順序,您可以選擇先行後列先列後行
  • 然後,點擊添加按鈕選擇圖片文件或文件夾以將圖片添加到圖片列表中;
  • 點擊 導入大小按鈕,在 導入圖片大小對話框中,選擇匹配儲存格大小選項。
  • A screenshot of the Import Picture Size dialog box

3. 完成設置後,請點擊導入按鈕,現在,另一個導入圖片彈出,指定您將導入圖片的目標單元格,見截圖:

A screenshot showing the destination cells dialog during the Import Pictures process

4. 然後,點擊確定按鈕,所有選定的圖片已插入以匹配特定單元格的大小,如下截圖所示:

A screenshot of multiple images inserted and resized to match Excel cell sizes using Kutools


插入多個與名稱匹配的圖片到單元格

如果您在一列中有一個產品名稱列表,現在,您需要將其對應的圖片插入到另一列中,如下截圖所示。插入圖片,然後一個一個地將它們拖到每個位置會浪費很多時間,本節將討論一些快速方法。

A screenshot of an Excel table with product names and corresponding images

使用 VBA代碼插入多個與名稱匹配的圖片

以下 VBA代碼可以幫助您快速插入多個匹配其名稱的圖片,請按以下步驟操作:

1. 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2. 點擊插入 > 模塊,然後將以下宏粘貼到模塊窗口中。

VBA代碼:插入多個匹配其名稱的圖片

Sub InserPictureByName()
'Updateby Extendoffice
Dim xFDObject As FileDialog
Dim xStrPath, xStrPicPath As String
Dim xRgName, xRgInser, xRg, xRgI As Range
Dim xFNum As Integer
Set xFDObject = Application.FileDialog(msoFileDialogFolderPicker)
With xFDObject
    .Title = "Please select the folder:"
    .InitialFileName = Application.ActiveWorkbook.Path
    .Show
    .AllowMultiSelect = False
End With
On Error Resume Next
xStrPath = ""
xStrPath = xFDObject.SelectedItems.Item(1)
If xStrPath = "" Then
Exit Sub
End If
Set xRgName = Application.InputBox("Please select the cells contain the image name:", "Kutools for Excel", , , , , , 8)
If xRgName Is Nothing Then
    MsgBox "No cells are select, exit operation! ", vbInformation, "Kutools for Excel"
    Exit Sub
End If
Set xRgInser = Application.InputBox("Please select the cells to output the images", "Kutools for Excel", , , , , , 8)
If xRgInser Is Nothing Then
    MsgBox " No cells are select, exit operation.! ", vbInformation, "Kutools for Excel"
    Exit Sub
End If
For xFNum = 1 To xRgName.Count
    Set xRg = xRgName.Item(xFNum)
    Set xRgI = xRgInser.Item(xFNum)
    xStrPicPath = xStrPath & "\" & xRg.Text & ".png"
    If Not Dir(xStrPicPath, vbDirectory) = vbNullString Then
        With xRgI.Parent.Pictures.Insert(xStrPicPath)
            .Left = xRgI.Left
            .Top = xRgI.Top
            .ShapeRange.LockAspectRatio = msoFalse
            .ShapeRange.Height = 60
            .ShapeRange.Width = 60
        End With
    End If
Next
End Sub

注意:在上述代碼中,您可以在腳本中更改圖片的高度和寬度 “.ShapeRange.Height =60”, “.ShapeRange.Width =60”以滿足您的需要。

3. 然後,按 F5 鍵運行此代碼,在打開的窗口中,請選擇包含您想要插入的圖片的文件夾,見截圖:

A screenshot of the folder selection dialog box for inserting pictures

4. 然後,點擊 確定按鈕,彈出一個提示框,請選擇包含圖片名稱的單元格,見截圖:

A screenshot of the prompt to select cells containing image names for VBA code

5. 繼續點擊確定按鈕,然後彈出另一個提示框,請選擇您想要輸出圖片的單元格,見截圖:

A screenshot of the prompt to select output cells for images

6. 最後,點擊確定,圖片已根據其名稱立即插入到單元格中,見截圖:

A screenshot showing images inserted into Excel cells based on their names using VBA


使用實用功能插入多個與名稱匹配的圖片

如果您有 Kutools for Excel,使用其匹配導入圖片功能,您可以快速輕鬆地根據圖片名稱插入圖片。

Kutools for Excel - 包含超過 300 種 Excel 必備工具。永久免費享受 AI 功能!立即下載!

1. 點擊 Kutools Plus > 導入 & 匯出 > 匹配導入圖片,見截圖:

A screenshot of the Match Import Pictures option in Kutools Plus tab in Excel

2. 在彈出的匹配導入圖片對話框中,請執行以下操作:

  • 從導入順序下拉列表中指定圖片順序,您可以選擇 先行後列先列後行
  • 然後,從匹配區域文本框中,選擇您想要根據圖片名稱插入圖片的名稱;
  • 然後,點擊添加按鈕選擇圖片文件或文件夾以將圖片添加到圖片列表中;
  • 接下來,您應該指定圖片大小。請點擊導入大小按鈕,在導入圖片大小對話框中,選擇一個您需要的圖片大小。
  • A screenshot of the Import Picture Size dialog box

3. 完成設置後,請點擊導入按鈕,從彈出的匹配導入圖片對話框中選擇一個單元格或一個單元格列表以定位圖片,見截圖:

A screenshot of the Match Import Pictures dialog for locating images in Excel

4. 然後,點擊確定,所有與單元格值匹配的圖片名稱的圖片已插入,見截圖:

A screenshot showing images inserted into Excel cells matching names using Kutools


從網址插入或顯示圖片

您是否曾嘗試從網址列表中顯示或插入圖片?可能沒有其他好的方法可以直接在 Excel 中插入圖片,但您可以應用代碼或第三方工具來處理它。

使用 VBA代碼從網址插入或顯示圖片

請應用以下 VBA代碼根據網址列表插入圖片。

1. 首先,調整您想要定位圖片的相鄰單元格大小。

2. 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

3. 點擊插入 > 模塊,然後將以下宏粘貼到模塊窗口中。

VBA代碼:從網址列表插入圖片

Sub URLPictureInsert()
'Updateby Extendoffice
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("A2:A5")
For Each cell In Rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 1
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoFalse
If .Width > xRg.Width Then .Width = xRg.Width * 2 / 3
If .Height > xRg.Height Then .Height = xRg.Height * 2 / 3
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("A2").Select
Next
Application.ScreenUpdating = True
End Sub

注意:在上述代碼中,A2:A5 是包含您想要提取圖片的網址地址的單元格範圍,您應該根據需要更改單元格引用。

4. 然後按 F5 鍵運行此代碼,匹配的圖片將從網址中提取到相鄰列並放置在單元格的中心,見截圖:

A screenshot of pictures extracted from URLs into adjacent cells in Excel


使用驚人的功能從網址插入或顯示圖片

Kutools for Excel 有一個驚人的功能—— 從路徑(網址)插入圖片。使用此工具,對應的圖片將快速輕鬆地從網址中提取。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 點擊 Kutools > 插入 > 從路徑(網址)插入圖片,見截圖:

A screenshot of the Insert Pictures from Path (URL) option in Kutools tab in Excel

2. 在彈出的從路徑(網址)插入圖片對話框中,請設置以下操作:

  • 選擇網址單元格列表和您想要放置圖片的單元格範圍;
  • 圖片大小部分根據需要指定圖片的大小。
  • A screenshot of the Insert Pictures from Path (URL) dialog

3. 然後,點擊確定按鈕,所有圖片已從網址中提取,見截圖:

A screenshot showing pictures inserted from URLs using Kutools


從檔案路徑插入或顯示圖片

如果您需要從檔案路徑插入圖片,這裡也提供了解決方案。

使用 VBA代碼從檔案路徑插入或顯示圖片

您可以應用以下 VBA代碼根據圖片檔案路徑插入圖片。

1. 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2. 點擊 插入 > 模塊,然後將以下代碼粘貼到模塊窗口中。

VBA代碼:從一範圍的檔案路徑插入圖片

Sub InsertPicFromFilePath()
'Updateby Extendoffice
    Dim xRg As Range
    Dim xCell As Range
    Dim xVal As String
    On Error Resume Next
    Set xRg = Application.InputBox("Please select file path cells:", "KuTools for Excel", Selection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    For Each xCell In xRg
        xVal = xCell.Value
        If xVal <> "" Then
            ActiveSheet.Shapes.AddPicture xCell.Value, msoFalse, msoTrue, _
            xCell.Offset(0, 1).Left, xCell.Top, xCell.Height, _
            xCell.Height
        End If
    Next
    Application.ScreenUpdating = True
End Sub

3. 插入上述代碼後,按 F5 鍵運行此代碼,然後彈出一個提示框,請選擇檔案路徑的單元格,見截圖:

A screenshot of the VBA prompt to select file path cells in Excel

4. 然後點擊確定按鈕,所有基於檔案路徑的圖片已顯示到下一列,如下截圖所示:

A screenshot showing images displayed in Excel from file paths using VBA


使用驚人的功能從檔案路徑插入或顯示圖片

Kutools for Excel從路徑(網址)插入圖片功能也可以幫助您顯示來自檔案路徑的相關圖片。

Kutools for Excel - 包含超過 300 種 Excel 必備工具。永久免費享受 AI 功能!立即下載!

1. 點擊 Kutools > 插入 > 從路徑(網址)插入圖片,在彈出的對話框中,請指定檔案路徑範圍、輸出圖片的範圍、圖片大小,見截圖:

A screenshot of Insert Pictures from Path (URL) option in Kutools tab in Excel and the Insert Pictures from Path (URL) dialog

2. 設置選項後,點擊確定按鈕,圖片將立即插入到選定的單元格中,見截圖:

A screenshot showing images inserted into Excel cells from file paths using Kutools


將圖片插入到批註中

可能將圖片插入到單元格中很容易,但有時,您可能想要將圖片插入到批註框中,您如何處理這項任務?

1. 選擇並右鍵單擊您想要插入批註的單元格,然後選擇插入批註,見截圖:

提示:如果您已插入批註,請忽略此步驟。

A screenshot showing the Insert Comment option in Excel

2. 然後將光標懸停在批註框的邊緣,直到您看到光標變成四箭頭圖標。然後,右鍵單擊並選擇格式化批註選項,見截圖:

A screenshot showing the Format Comment option in Excel

3. 在彈出的格式化批註對話框中,點擊顏色和線條選項卡,然後從顏色下拉列表中選擇填充效果,見截圖:

A screenshot of the Format Comment dialog showing the Colors and Lines tab in Excel

4. 然後,在隨後的填充效果對話框中,點擊圖片選項卡,然後點擊選擇圖片按鈕選擇您想要插入的圖片,見截圖:

A screenshot of the Fill Effects dialog box for selecting a picture in Excel comments

5. 然後,點擊確定 > 確定,圖片已插入到批註框中,見截圖:

A screenshot of a picture inserted into an Excel comment box


將圖片插入到頁首或頁尾中

如果您想將圖片插入到 Excel 工作表的頁首或頁尾中,本節中的步驟可以幫助您,請按以下步驟操作:

1. 啟用您想要將圖片插入到頁首或頁尾的工作表。

2. 然後,點擊插入 > 頁首和頁尾,您將進入頁首和頁尾工具選項卡。見截圖:

A screenshot showing the Header & Footer Tools tab in Excel

3. 要在頁首或頁尾中插入圖片,請點擊您需要的左、右或中間頁首或頁尾框,然後在設計選項卡下點擊圖片,見截圖:

A screenshot of the Picture button in the Design tab of Header & Footer Tools in Excel

4. 然後,將彈出一個插入圖片窗口,請選擇您想要添加的圖片並點擊插入。現在,頁首或頁尾框中將出現一個 &[圖片]佔位符。點擊頁首或頁尾框外的任意位置,插入的圖片將顯示如下截圖所示:

A screenshot of a picture displayed in the Excel worksheet header

提示:有時,您可能會發現圖片與工作表的數據區域重疊,如下截圖所示。這是因為圖片太大,無法自動調整大小以適應頁首或頁尾部分框。

A screenshot showing an oversized header image overlapping the data area in Excel

要解決此問題,您只需調整頁首或頁尾中的圖片大小,請按照以下步驟操作:

1. 點擊圖片所在的頁首或頁尾部分,然後在設計選項卡下點擊格式圖片,見截圖:

A screenshot showing the Format Picture option for resizing an image in the header or footer in Excel

2. 在格式圖片對話框中,大小選項卡下,請調整圖片的大小以適應頁首或頁尾部分框,見截圖:

A screenshot of the Format Picture dialog's Size tab for adjusting image size in Excel

3. 然後,點擊確定,您將獲得所需的結果。


將相同的圖片插入到多個工作表中

有時,您可能想要將標誌圖片插入到工作簿的所有工作表中,通常,您可以應用插入功能將圖片從一個工作表插入到另一個工作表。除了這個耗時的功能,以下 VBA代碼可以幫助您將相同的圖片一次性插入到所有工作表的特定單元格中。請按照以下步驟操作:

1. 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2. 點擊插入 > 模塊,然後將以下代碼粘貼到 模塊窗口中。

VBA代碼:將相同的圖片插入到所有工作表中:

Sub InsertImagetoallsheets()
'Updateby Extendoffice
    Dim I As Long
    Dim xPath As String
    Dim xShape As Shape
    Dim xRg As Range
    xPath = "C:\Users\AddinTestWin10\Desktop\my images\logo.png"
    If Dir(xPath) = "" Then
        MsgBox "Picture file was not found in path!", vbInformation, "KuTools for Excel"
        Exit Sub
    End If
    For I = 1 To ActiveWorkbook.Sheets.Count
        Set xRg = Sheets(I).Range("A1")
        Set xShape = Sheets(I).Shapes.AddPicture(xPath, True, True, xRg.Left, xRg.Top, xRg.Width, xRg.Height)
    Next
End Sub

注意:在上述代碼中,C:\Users\AddinTestWin10\Desktop\my images\logo.png 是圖片的路徑和名稱,A1Range("A1") 是您想要插入圖片的單元格,請根據需要更改它們。

3. 然後按 F5 鍵運行此代碼,特定圖片已立即插入到每個工作表的 A1 單元格中。見下方演示:

A demonstration of inserting the same image into multiple worksheets in Excel using VBA


將圖片插入到單元格內容後面

為了使工作表數據更美觀和吸引人,您可以使用圖片作為背景。為了在單元格內容後面插入圖片,這裡有一些方法可以幫助您。

使用背景功能將圖片插入到單元格內容後面

1. 打開您想要插入背景圖片的工作表。

2. 然後,點擊 頁面佈局 > 背景,見截圖:

A screenshot of the Page Layout tab showing the Background option in Excel

3. 在彈出的 插入圖片窗口中,請從您的電腦、網站或 OneDrive 中選擇一張圖片,見截圖:

A screenshot of the Insert Pictures dialog box for adding a background image in Excel

4. 現在,圖片已作為背景插入到工作表中,如下截圖所示:

A screenshot showing a worksheet with a background image in Excel

提示:要刪除背景圖片,只需點擊頁面佈局 > 刪除背景。見截圖:

A screenshot showing the Delete Background option in the Page Layout tab in Excel


將透明圖片插入到單元格內容後面

使用上述方法,您無法更改插入背景圖片的透明度,因此,如果背景圖片的顏色較重,閱讀工作表數據會不方便。本節將討論如何在單元格後面插入透明圖片。

1. 點擊插入 >形狀,然後選擇一個矩形形狀,見截圖:

A screenshot of the Insert Shapes option in Excel for creating a custom background

2. 然後,在當前工作表中繪製一個您需要大小的形狀。

3. 繪製形狀後,功能區中顯示繪圖工具選項卡,然後點擊格式 >形狀輪廓 > 無輪廓,見截圖:

A screenshot showing the Shape Outline option to remove the border of a shape in Excel

4. 然後,右鍵單擊形狀,選擇格式化形狀,見截圖:

A screenshot of the Format Shape option

5. 在展開的格式化形狀窗格中,填充和線條選項卡下,執行以下操作:

  • 填充部分,選擇 圖片或紋理填充選項;
  • 圖片來源中點擊 插入按鈕,選擇您想要插入的圖片;
  • 然後,從透明度部分根據需要調整圖片的透明度。
  • A screenshot of the Format Shape pane for adjusting transparency and inserting pictures in Excel

6. 然後,您將看到填充圖片的形狀看起來像背景圖片,如上截圖所示。

注意:插入此類背景圖片後,您將無法在圖片範圍內輸入任何文字。


將透明圖片作為水印插入到單元格內容後面

上述兩種方法各有其限制,第一種方法無法更改圖片透明度,第二種方法不允許在圖片區域內的單元格中輸入文字。為了解決這些問題, Kutools for Excel插入水印功能可以幫助您。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 點擊 Kutools > 插入 > 插入水印,見截圖:

A screenshot of the Insert Watermark option in Kutools tab in Excel

2. 在彈出的插入水印對話框中,選擇圖片水印,然後點擊選擇圖片按鈕選擇您想要插入的圖片,然後指定圖片縮放比例並勾選沖蝕選項,見截圖:

A screenshot of the Insert Watermark dialog box

3. 然後,點擊確定按鈕,圖片已作為背景圖片插入到工作表中。


將一範圍的單元格插入為 Excel 中的圖片格式

您是否曾嘗試將一範圍的單元格複製並插入為 Excel 中的圖片?本節將介紹一些快速方法來處理這項工作。

使用複製為圖片功能將一範圍的單元格插入為圖片格式

在 Excel 中,您可以使用複製為圖片功能將一範圍的單元格複製並插入為圖片。

1. 選擇您想要複製並插入為圖片的單元格範圍。

2. 然後,點擊 首頁 > 複製 > 複製為圖片,見截圖:

A screenshot showing the Copy as Picture option in Excel's Home tab

3. 在彈出的複製圖片對話框中,從格式部分選擇圖片,見截圖:

A screenshot of the Copy Picture dialog in Excel for selecting format options

4. 然後,點擊確定按鈕,現在,您只需按 Ctrl + V 將圖片粘貼到工作簿的任意位置。

A screenshot of an image created from a copied range of cells in Excel


使用相機工具將一範圍的單元格插入為圖片格式

在 Excel 中,有一個相機工具可以幫助您為選定的數據拍照,然後將其粘貼為圖片。當原始數據更改時,複製的圖片將動態更改。

首先,您應該在功能區上顯示相機,然後應用它。

1. 點擊自訂快速訪問工具欄圖標,然後點擊更多命令選項,見截圖:

A screenshot of the More Commands option from the Customize Quick Access Toolbar menu

2. 在打開的 Excel 選項對話框中,請執行以下操作:

  • 選擇命令來源下拉列表中選擇所有命令
  • 然後,從列表框中滾動選擇相機
  • 然後,點擊添加按鈕將此工具添加到自訂快速訪問工具欄
  • 最後,點擊確定關閉此對話框。
  • A screenshot of Excel Options dialog to add the Camera tool to the ribbon

3. 相機工具已顯示在功能區上,見截圖:

A screenshot showing the Camera tool added to the Quick Access Toolbar in Excel

4. 然後,選擇您想要作為圖片的單元格範圍。

5. 然後,點擊 相機工具,然後轉到工作表並點擊任意位置,數據範圍將作為圖片插入,如下演示所示:

A demonstration of using the Camera tool to create an image of a data range in Excel


使用實用功能將一範圍的單元格插入為圖片格式

如果您有 Kutools for Excel,使用其資源庫功能,您可以將選定的數據保存到資源庫中,然後根據需要將其用作圖片或文字。

Kutools for Excel - 包含超過 300 種 Excel 必備工具。永久免費享受 AI 功能!立即下載!

1. 選擇您想要插入為圖片的數據範圍。

2. 然後,點擊 Kutools > 導航,見截圖:

A screenshot showing Kutools for Excel's Navigation option in Excel ribbon

3. 在展開的導航窗格中,點擊資源庫圖標,然後點擊將選定內容新增到資源庫圖標,見截圖:

A screenshot of adding selected content to Resource Library

4. 在新增到資源庫對話框中,為此項目指定一個名稱,然後選擇您想要添加到的組。見截圖:

A screenshot of the New Resource Library Entry dialog

5. 然後,點擊添加按鈕將其添加到資源庫窗格。如果您想將此範圍插入為圖片,只需點擊一個單元格以定位圖片,然後從資源庫窗格中找到保存的項目,然後從項目的下拉列表中點擊插入為 > 圖片(EMF)。數據範圍將作為圖片插入到工作表中,見截圖:

A screenshot showing data inserted as a picture using Kutools for Excel's Resource Library


根據單元格值動態插入圖片

在本節中,我將向您展示如何根據單元格值顯示特定圖片。例如,我想在從下拉單元格中選擇特定項目時顯示相應的圖片,當我選擇另一個項目時,圖片將動態更改,如下演示所示:

A demonstration of dynamically changing images based on selected drop-down values in Excel

使用命名區域功能根據單元格值動態插入圖片

通常,在 Excel 中,您可以創建一個動態命名區域,然後使用鏈接圖片來解決此任務。

1. 首先,您應該創建兩列,其中包含產品名稱和相關圖片,見截圖:

A screenshot of two columns containing product names and their corresponding images in Excel

2. 然後,請為單元格值創建一個下拉列表。點擊一個單元格以輸出下拉列表,然後點擊數據 > 數據驗證 > 數據驗證,見截圖:

A screenshot showing the Data Validation option in Excel for creating a drop-down list

3. 在彈出的數據驗證對話框中, 設置選項卡下,從 允許下拉列表中選擇列表,然後從來源文本框中選擇您想要創建下拉列表的單元格,見截圖:

A screenshot of the Data Validation dialog box for selecting list options in Excel

4. 點擊 確定,單元格值的下拉列表已創建,從下拉列表中選擇一個項目,見截圖:

A screenshot of a drop-down list created in Excel for selecting products

5. 然後,點擊公式 > 定義名稱,見截圖:

A screenshot showing the Define Name option in Excel's Formulas tab

6. 在新建名稱對話框中,請執行以下操作:

  • 名稱文本框中輸入一個名為 myimage 的名稱;
  • 然後複製並粘貼此公式: =INDEX(Sheet11!$A$2:$B$6,MATCH(Sheet11!$E$2,Sheet11!$A$2:$A$6,0),2) 到引用位置文本框中。

    A screenshot of the New Name dialog box with a dynamic formula for referencing images in Excel

    注意:在上述公式中:

    • Sheet11!$A$2:$B$6:是包含您想要使用的值和圖片的工作表和範圍;
    • Sheet11!$E$2:是您在工作表中創建下拉列表的單元格;
    • Sheet11!$A$2:$A$6:是您基於其創建下拉列表的單元格列表;
    • 變量數字2 是包含圖片的列號。如果您的圖片在 C 列中,您應該輸入3。

7. 然後,點擊 確定按鈕,然後請從原始範圍中根據 E2 單元格值複製並粘貼相應的圖片到 F2 單元格,見截圖:

A screenshot of a copied picture next to a drop-down list in Excel

8. 接下來,請選擇 F2 單元格中的圖片,然後在公式欄中輸入此公式 =myimagemyimage 是您在步驟6 中創建的範圍名稱),見截圖:

A screenshot showing how to link a picture to a named range using a formula in Excel

9. 輸入公式後,按 Enter 鍵,現在,當您從下拉列表中選擇一個項目時,其相關圖片將立即顯示。見截圖:

A screenshot showing a dynamically updated image based on a selected drop-down value in Excel


使用便捷功能根據單元格值動態插入圖片

上述方法對於大多數人來說可能很困難,這裡,我將介紹一個便捷功能——Kutools for Excel建立圖片下拉清單,使用此實用工具,您可以僅需幾次點擊即可創建多個下拉列表及其相關圖片。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 首先,您應該在工作表中創建兩列,其中包含產品名稱和相關圖片。

2. 然後,點擊 Kutools > 下拉列表 > 建立圖片下拉清單,見截圖:

A screenshot of the Picture Drop-down List option in Kutools for Excel

3. 在建立圖片下拉清單對話框中,如果您已創建了單元格值和圖片的列,請忽略步驟1,然後,選擇原始數據和圖片範圍以及輸出範圍,見截圖:

A screenshot of the Picture Drop-down List dialog box for linking images to drop-down lists

4. 然後,點擊確定按鈕,帶有圖片的下拉列表已創建到選定的單元格中,當從下拉單元格中選擇一個項目時,其對應的圖片將立即顯示,見下方演示:

A demonstration of creating drop-down lists with dynamic images using Kutools


從 Excel 文件中匯出或保存所有圖片

如果您的工作簿中有多個圖片,現在,您想要從 Excel 文件中提取並保存所有圖片到一個文件夾中。您如何在 Excel 中解決這項任務?

使用另存為功能從 Excel 匯出或保存所有圖片

通常,您可以使用另存為功能從工作簿中保存所有圖片,請按以下步驟操作:

1. 點擊文件 >另存為,在另存為窗口中,指定一個文件夾以放置匯出的文件,然後從 保存格式下拉列表中選擇網頁(*.htm;*.html),見截圖:

A screenshot showing the Save As window in Excel for saving as a Web Page

2. 然後點擊保存按鈕,轉到特定文件夾,您將看到兩個文件,一個是 HTML 格式文件,另一個是包含工作簿中的圖片、圖表或其他對象的文件夾。見截圖:

A screenshot showing the saved HTML file and folder containing images exported from Excel

3. 然後您可以根據需要將圖片拖到另一個文件夾中。

注意:通過使用此另存為功能,您將獲得每張圖片的兩個版本,一個較小,另一個較大,因此您可以根據需要保存更高解析度的圖片。


通過更改文件擴展名從 Excel 匯出或保存所有圖片

要從 Excel 文件中保存所有圖片,您還可以將文件擴展名更改為 RAR。請按以下步驟操作:

1. 將文件擴展名 xlsx 更改為 rar,如下截圖所示:

A screenshot demonstrating how to change an Excel file extension to .rar

2. 然後,解壓縮文件,您將看到文件夾中有3 個文件夾和1 個文件,見截圖:

A screenshot of the unzipped folder structure after changing an Excel file to .rar format

3. 然後,點擊打開 xl 文件夾,然後打開 media 文件夾,您將看到所有圖片都存儲在這裡,沒有重複,見截圖:

A screenshot of the media folder containing all images exported from Excel


使用強大功能從 Excel 匯出或保存所有圖片

如果您有 Kutools for Excel,使用其匯出圖形功能,您可以快速匯出一些特定對象,如圖片、圖表、形狀到您需要的圖片格式。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 點擊 Kutools Plus > 導入 & 匯出 > 匯出圖形,見截圖:

A screenshot showing the Export Graphics option in Kutools Plus tab in Excel

2. 在匯出圖形對話框中,執行以下操作:

  • 類型下拉列表中選擇圖片選項;
  • 指定一個文件夾以保存您的匯出圖片;
  • 然後從匯出格式的下拉列表中選擇一個圖片格式。
  • A screenshot of the Export Graphics dialog box

3. 最後,點擊 確定按鈕,當前工作簿中的所有圖片已保存到您指定的文件夾中,見截圖:

A screenshot showing pictures exported using Kutools for Excel's Export Graphics feature


根據 Excel 中的單元格列表重命名文件夾中的圖片名稱

如果您在文件夾中有很多圖片,現在,您想要重命名所有這些圖片,您如何在 Excel 中輕鬆解決這項工作?

在 Excel 中,首先,您應該將所有舊圖片名稱列入一列,然後輸入新名稱,最後,應用 VBA代碼一次性替換舊名稱為新名稱。請按照以下步驟操作:

1. 請將所有圖片名稱列入一個單元格列表中,或者您可以應用以下代碼列出特定文件夾中的所有圖片名稱,而無需手動一一輸入。

2. 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

3. 點擊插入 > 模塊,然後將以下宏粘貼到 模塊窗口中。

VBA代碼:列出文件夾中的所有圖片名稱

Sub MainList()
'Updateby Extendoffice
On Error Resume Next
Set xRg = Application.InputBox("Please select a cell to put the filenames:", "KuTools For Excel", Selection.Address, , , , , 8)
If xRg Is Nothing Then Exit Sub
Set xRg = xRg(1)
Set Folder = Application.FileDialog(msoFileDialogFolderPicker)
If Folder.Show <> -1 Then Exit Sub
xDir = Folder.SelectedItems(1)
Call ListFilesInFolder(xRg, xDir, True)
End Sub
Sub ListFilesInFolder(ByVal xRg As Range, ByVal xFolderName As String, ByVal xIsSubfolders As Boolean)
Dim xFileSystemObject As Object
Dim xFolder As Object
Dim xSubFolder As Object
Dim xFile As Object
Dim rowIndex As Long
Set xFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set xFolder = xFileSystemObject.GetFolder(xFolderName)
rowIndex = 1
For Each xFile In xFolder.Files
xRg.Formula = xFile.Name
Set xRg = xRg.Offset(rowIndex)
rowIndex = 1
Next xFile
If xIsSubfolders Then
For Each xSubFolder In xFolder.SubFolders
ListFilesInFolder xRg, xSubFolder.Path, True
Next xSubFolder
End If
Set xFile = Nothing
Set xFolder = Nothing
Set xFileSystemObject = Nothing
End Sub

4. 然後,按 F5 鍵運行此代碼,彈出一個提示框,請點擊一個單元格以輸出圖片名稱,見截圖:

A screenshot showing the prompt to select a cell for outputting filenames in Excel

5. 然後,點擊確定,另一個瀏覽對話框將彈出,請選擇包含您想要列出所有圖片名稱的圖片的文件夾,見截圖:

A screenshot of the Browse dialog box for selecting a folder containing images

6. 點擊 確定,特定文件夾中的所有圖片名稱已列入單元格中,見截圖:

A screenshot showing all image names from a folder listed in Excel

7. 然後,將您需要的新名稱輸入到另一列中,如下截圖所示:

A screenshot showing new image names entered in another column in Excel

8. 然後,您可以應用以下代碼重命名圖片,繼續按 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

9. 點擊插入 > 模塊,然後將以下宏粘貼到 模塊窗口中。

VBA代碼:重命名文件夾中的多個文件

Sub RenameFiles()
'Updateby Extendoffice
Dim xDir As String
Dim xFile As String
Dim xRow As Long
With Application.FileDialog(msoFileDialogFolderPicker)
    .AllowMultiSelect = False
If .Show = -1 Then
    xDir = .SelectedItems(1)
    xFile = Dir(xDir & Application.PathSeparator & "*")
    Do Until xFile = ""
        xRow = 0
        On Error Resume Next
        xRow = Application.Match(xFile, Range("A:A"), 0)
        If xRow > 0 Then
            Name xDir & Application.PathSeparator & xFile As _
            xDir & Application.PathSeparator & Cells(xRow, "B").Value
        End If
        xFile = Dir
    Loop
End If
End With
End Sub

注意:在上述代碼中,A:A 表示您想要重命名的舊圖片名稱列表,而 B 包含您想要使用的新圖片名稱,您可以根據需要更改它們。

10. 然後,按 F5 鍵運行此代碼,在彈出的瀏覽窗口中,選擇包含您想要重命名的圖片的文件夾,見截圖:

A screenshot of the Browse dialog box for selecting a folder containing images

11. 然後,點擊確定按鈕,所有圖片名稱已替換為新名稱,如下截圖所示:

A screenshot showing renamed image files listed in Excel


點擊圖片時放大或縮小

假設,您已將一個小圖片插入到工作表中,現在,您想要在點擊時放大圖片,再次點擊時縮小,如下演示所示。您如何在 Excel 中解決這項任務?

A demo GIF showing an image being enlarged and shrunk in Excel on click

要在點擊時放大或縮小圖片大小,以下代碼可以幫助您。請按照以下步驟操作:

1.右鍵單擊圖片,選擇分配宏,見截圖:

A screenshot showing how to assign a macro to an image in Excel

2. 然後,在彈出的分配宏對話框中,點擊 新建按鈕,見截圖:

A screenshot of the Assign Macro dialog box with the New button highlighted

3. 在 Microsoft Visual Basic for Applications 窗口中,請在 SubEnd Sub代碼之間複製並粘貼以下代碼。見截圖:

Dim shp As Shape
    Dim big As Single, small As Single
    Dim shpDouH As Double, shpDouOriH As Double
    big = 3  
    small = 1
    On Error Resume Next
    Set shp = ActiveSheet.Shapes(Application.Caller)
    With shp
        shpDouH = .Height
        .ScaleHeight 1, msoTrue, msoScaleFromTopLeft
        shpDouOriH = .Height
     
        If Round(shpDouH / shpDouOriH, 2) = big Then
            .ScaleHeight small, msoTrue, msoScaleFromTopLeft
            .ScaleWidth small, msoTrue, msoScaleFromTopLeft
            .ZOrder msoSendToBack
        Else
            .ScaleHeight big, msoTrue, msoScaleFromTopLeft
            .ScaleWidth big, msoTrue, msoScaleFromTopLeft
            .ZOrder msoBringToFront
        End If
    End With

A screenshot of the VBA code to enlarge and shrink images in Excel when clicked

4. 然後按 Alt + Q 鍵關閉 Microsoft Visual Basic for Applications 窗口。現在,當您點擊圖片時,它將放大到您指定的大小,再次點擊將縮小到原始大小,如下演示所示:

A demo GIF showing an image being enlarged and shrunk in Excel on click


滾動工作表時始終浮動圖片

有時,您可能想要在工作表屏幕上浮動一張圖片,即使在向上或向下滾動工作表時,這樣您可以始終看到圖片。在本節中,我將介紹一個快速技巧來幫助您在 Excel 中處理這項工作。請按照以下步驟操作:

1. 首先,插入您想要使用的圖片。

2. 然後,右鍵單擊包含您想要始終保持可見的圖片的工作表標籤,然後從上下文菜單中選擇查看代碼。在打開的 Microsoft Visual Basic for applications 窗口中,將以下代碼複製並粘貼到空白模塊中:

VBA代碼:在工作表中始終浮動圖片

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice
    Application.ScreenUpdating = False
    If Target.Cells.Count > 1 Then Exit Sub
        With ActiveSheet.Shapes("Picture1")
            .Top = ActiveWindow.VisibleRange.Top + 5
            .Left = ActiveWindow.VisibleRange.Left + ActiveWindow.VisibleRange.Width - .Width - 45
        End With
    Application.ScreenUpdating = False
End Sub

A screenshot showing VBA code to make a picture float while scrolling in Excel

注意:在此代碼中,圖片1 是您插入的圖片名稱,請根據需要更改它。

3. 然後,保存並關閉代碼窗口,現在,當滾動工作表並點擊一個單元格時,圖片將始終保持在工作表的右上角。見截圖:

A screenshot showing a picture floating in the top-right corner of a worksheet in Excel


從當前工作表/一範圍的單元格中刪除圖片

您是否有任何快速方法可以從工作表、一範圍的單元格或當前工作簿中刪除所有圖片?本節將介紹一些方法來解決這項工作。

使用 VBA代碼從當前工作表中刪除圖片

要從當前工作表中刪除圖片,以下 VBA代碼可以幫助您,請按以下步驟操作:

1. 啟用包含您想要刪除的圖片的工作表。

2. 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

3. 點擊插入 > 模塊,然後將以下宏粘貼到模塊窗口中。

VBA代碼:刪除當前工作表中的所有圖片

Sub DeleteAllPics()
'Updateby Extendoffice
Dim Pic As Object
For Each Pic In ActiveSheet.Pictures
Pic.Delete
Next Pic
End Sub

4. 然後,按 F5 鍵運行此代碼,當前工作表中的所有圖片將立即被刪除。


使用 VBA代碼從一範圍的單元格中刪除圖片

如果您只需要從一範圍的單元格中刪除圖片,這裡有另一個簡單的代碼可以幫助您。

1. 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

2. 點擊插入 > 模塊,然後將以下宏粘貼到模塊窗口中。

VBA代碼:從一範圍的單元格中刪除圖片

Sub DeletePic()
'Updateby Extendoffice
    Dim xPicRg As Range
    Dim xPic As Picture
    Dim xRg As Range
    Application.ScreenUpdating = False
    Set xRg = Range("B4:C6")
    For Each xPic In ActiveSheet.Pictures
        Set xPicRg = Range(xPic.TopLeftCell.Address & ":" & xPic.BottomRightCell.Address)
        If Not Intersect(xRg, xPicRg) Is Nothing Then xPic.Delete
    Next
    Application.ScreenUpdating = True
End Sub

注意:在上述代碼中,B4:C6 是您想要刪除圖片的範圍。

3. 然後,按 F5 鍵運行此代碼,選定範圍中的圖片將立即被刪除,見截圖:

A screenshot showing pictures being deleted from a selected range in Excel


使用便捷功能從當前工作表、選中工作表、所有工作表中刪除圖片

如果您有 Kutools for Excel,使用其刪除插圖和對象功能,您可以快速從工作表、一些選定的工作表或整個工作簿中刪除圖片。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 點擊 Kutools > 刪除 > 刪除插圖和對象,見截圖:

A screenshot showing the Kutools Delete Illustrations & Objects feature in Excel

2. 在打開的刪除插圖和對象對話框中,從刪除部分勾選圖片,然後在 尋找範圍部分指定您想要刪除圖片的範圍,見截圖:

A screenshot of the Delete Illustrations & Objects dialog

3. 然後點擊確定按鈕,所有圖片將從工作表、選定的工作表或整個工作簿中刪除,根據您的指定。

最佳 Office 辦公效率工具

🤖 Kutools AI Aide:徹底革新數據分析,基於智能執行|生成程式碼|創建自訂公式|分析數據並生成圖表|調用 Kutools Functions
熱門功能查找、選取項目的背景色或標記重複值 | 刪除空行 | 合併列或單元格且不丟失資料 | 四捨五入...
高級 LOOKUP多條件查找|多值查找|多表查找|模糊查找...
高級下拉列表快速創建下拉列表 | 關聯下拉列表 | 多選下拉列表 ...
列管理器添加指定數量的列 | 移動列 | 切換隱藏列的可見狀態 | 區域與列比較 ...
精選功能網格聚焦 | 設計檢視 | 增強編輯欄 | 工作簿及工作表管理器 | 資源庫 (自動文本) | 日期提取器 | 合併資料 | 加密/解密儲存格 | 按清單發送電子郵件 | 超級篩選 | 特殊篩選(篩選粗體/傾斜/刪除線 ...)...
前15 大工具集12 款文本工具添加文本刪除特定字符,...)|50+ 種圖表 類型甘特圖,...)|40+ 實用 公式基於生日計算年齡,...)|19 款插入工具插入QR码按路徑插入圖片,...)|12 款轉換工具金額轉大寫匯率轉換,...)|7 款合併和分割工具高級合併行分割儲存格,...)| ...以及更多
使用 Kutools 支援你的語言——支援英語、西班牙語、德語、法語、中文及40 多種語言!

利用 Kutools for Excel 大幅提升你的 Excel 技能,感受前所未有的高效體驗。 Kutools for Excel 提供超過300 項高級功能,助你提升效率並保存時間。 點此查看你最需要的功能...


Office Tab 為 Office 帶來標籤式介面,讓你的工作更加輕鬆

  • 啟用 Word、Excel、PowerPoint 的標籤式編輯和閱讀功能
  • 在同一個視窗的標籤中打開和創建多個文件,而不是在新窗口中分開開啟。
  • 可提升你50% 的工作效率,每天為你大量減少滑鼠點擊次數!