如何在Excel中用相應的圖片替換文本?

      網友投稿 780 2025-04-03

      如何在Excel中用相應的圖片替換文本?

      如何在Excel中用相應的圖片替換文本?

      假設,我在工作表中有一個產品名稱列表,并且在計算機磁盤中有一個文件夾,其中包含產品名稱的對應圖片。 現在,我需要在Excel中查找產品名稱并將其替換為它們的相對圖像,而不必一一插入,如下圖所示。 在Excel中是否有任何好的快速解決方案來處理此工作?

      用VBA代碼用相應的圖片替換文本

      用相應的圖片替換文字 Kutools for Excel

      用VBA代碼用相應的圖片替換文本

      通常,沒有簡單直接的方法可讓我們在Excel中基于文本字符串插入相對圖片,但是,以下VBA代碼可以幫助您將文本替換為其對應的圖片。

      1. 媒體 Alt + F11鍵 顯示 Microsoft Visual Basic應用程序 窗口。

      2。 在窗口中,單擊 插頁 > 模塊 以顯示一個新的模塊窗口,然后將以下VBA代碼復制并粘貼到 模塊 窗口。

      VBA代碼:用相應的圖片替換文本

      Sub InsertPicture() Upadateby Extendoffice Dim xPath As String Dim xLastRow As Long Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8) Application.ScreenUpdating = False xPath = "C:\Users\dt\Desktop\Fruits\" If Right(xPath, 1) <> "\" Then xPath = xPath & "\" xLastRow = Cells(Rows.Count, "A").End(xlUp).Row For Each Rng In WorkRng If Rng.Value <> "" Then If Dir(xPath & Rng.Value & ".jpg") <> "" Then ActiveSheet.Pictures.Insert(xPath & Rng.Value & ".jpg").Select With Selection.ShapeRange .LockAspectRatio = msoFalse .Left = Rng.Left .Top = Rng.Top .Width = Rng.Width .Height = Rng.Height End With Rng.ClearContents Else Rng.Value = "N/A" End If End If Next Application.ScreenUpdating = True End Sub
      Copy
      3. Then press F5 key to run this code, and select the data range that you want to insert the corresponding pictures in the popped out dialog, see screenshot: 4. And then click OK button, all the corresponding images with the size as the same as the cells will be replaced with the original text, see screenshots: Notes: 1. In the above code, you need to change the folder path of the pictures to your need, xPath = "C:\Users\dt\Desktop\Fruits\". 2. If there are no corresponding pictures to match the text, the error N/A will display. Replace text with corresponding pictures with Kutools for Excel As the above code difficult to master, here, I will introduce you an easy and powerful tool - Kutools for Excel, with its Match Import Pictures feature, you can quickly and conveniently to insert the pictures to match the list of text. Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Go to DownloadFree Trial 30 daysPurchasePayPal / MyCommerce After installing Kutools for Excel, please do as this: 1. Click Kutools Plus > Import & Export > Match Import Pictures, see screenshot: 2. In the Match Import Pictures dialog box, click button to select the range that you want to match with the pictures, see screenshot: 3. Then in the Match Import Pictures dialog, click Add > File or Folder to find the pictures that you want to insert, see screenshot: 4. After inserting the corresponding images, then click Import size button, in the following Import Picture Size dialog, specify one option for the size of your picture. See screenshot: 5. Then click OK > Import, and then choose one cell to locate your relative images from the popped out Match Import Pictures dialog (you can also select the original cell of the text), see screenshot: 6. And then click OK button, all the pictures which match with the text have been inserted into the worksheet, see screenshot: Notes: 1. If there are no matched pictures with the text, the cell will not insert anything. 2. If you want to insert pictures horizontally, you can check Fill horizontally cell after cell in the Import order section. Download and free trial Kutools for Excel Now ! Demo: Replace text with corresponding pictures with Kutools for Excel Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial Now! Best office Productivity Tools Transform Hours into Minutes with Kutools for Excel! Ready to supercharge your Excel tasks? Harness the power of Kutools for Excel - your ultimate time-saving tool. Streamline intricate tasks and glide through your data like a pro. Experience Excel at lightning speed! Why You Need Kutools for Excel ??? Over 300 Powerful Features: Kutools is packed with more than 300 advanced features, simplifying your work in over 1500 scenarios. ?? Superior Data Processing: Merge cells, remove duplicates, and perform advanced data conversions – all without breaking a sweat! ?? Efficient Batch Operations: Why put in extra effort when you can work smart? Import, export, combine, and tweak data in bulk with ease. ?? Customizable Charts and Reports: Access a broad variety of additional charts and generate insightful reports that tell a story. ??? Powerful Navigation Pane: Gain an advantage with the robust Column Manager, Worksheet Manager, and Custom Favorites. ?? Seven Types of Drop-down Lists: Make data entry a breeze with drop-down lists of various features and types. ?? User-Friendly: A breeze for beginners and a powerful tool for experts. Download Now and Soar Through Time with Excel! Read More... Free Download... Purchase... Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project. Open and create multiple documents in new tabs of the same window, rather than in new windows. Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day! Read More... Free Download... Purchase...

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      上一篇:統計報表催報分析(統計報表催報通知單)
      下一篇:Word表格自動填充的有哪些操作方法(word中的表格如何自動填充)
      相關文章
      国产亚洲av片在线观看播放| 在线看亚洲十八禁网站| 亚洲国产精品久久久久秋霞影院| 黑人大战亚洲人精品一区| 亚洲jizzjizz少妇| 国产精品亚洲专区在线观看| 亚洲国产日韩在线| 亚洲资源在线视频| 亚洲国产美女精品久久久久∴| 浮力影院亚洲国产第一页| 亚洲人成人网站在线观看| 亚洲片国产一区一级在线观看| 亚洲国产精品自产在线播放| 亚洲男人在线无码视频| 亚洲AV无码乱码在线观看性色扶 | 亚洲另类小说图片| 91嫩草亚洲精品| 亚洲xxxxxx| 国产亚洲中文日本不卡二区| 亚洲一级在线观看| 国产成人精品日本亚洲专区6| 亚洲天堂2016| 亚洲乱妇熟女爽到高潮的片| 亚洲国产精品乱码一区二区| 亚洲人成7777| 国产婷婷综合丁香亚洲欧洲| 亚洲av永久无码精品网站| 亚洲国产成人久久精品影视| 亚洲国产天堂久久综合网站| 亚洲免费在线播放| 亚洲最新在线视频| 亚洲一卡一卡二新区无人区| 亚洲av无码无线在线观看| 亚洲av无码不卡私人影院| 老司机亚洲精品影视www| 亚洲va久久久噜噜噜久久狠狠 | 久久久青草青青国产亚洲免观| 亚洲熟妇丰满多毛XXXX| 国产亚洲综合色就色| 亚洲男人天堂av| 亚洲国产精品无码久久久|