
如何檢查單元格中是否包含Excel中的圖片?
在Excel的活動工作表中可以輕松找到并選擇所有圖片。 但是您知道如何在Excel中檢查單元格是否包含圖片嗎? 本文中的一種方法可以為您提供幫助。
檢查單元格是否包含帶有VBA代碼的圖片
檢查單元格是否包含帶有VBA代碼的圖片驚人的! 在 Excel 中使用高效的選項(xiàng)卡,如 Chrome、Firefox 和 Safari!每天節(jié)省50%的時(shí)間,并減少數(shù)千次鼠標(biāo)單擊!下面的VBA代碼可以幫助您檢查單元格中是否包含圖片。 請執(zhí)行以下操作。
1.打開您需要檢查指定單元格中是否存在圖片的工作表,然后按 其他 + F11 鍵打開 Microsoft Visual Basic應(yīng)用程序 窗口。
2.在 Microsoft Visual Basic應(yīng)用程序 窗口中,單擊 插頁 > 模塊。 然后將VBA代碼復(fù)制并粘貼到“代碼”窗口中。
VBA代碼:檢查單元格中是否包含Excel中的圖片
Sub CellHasPicture()Dim xRg As RangeDim xShape As ShapeDim xFlag As BooleanOn Error Resume NextSet xRg = Application.InputBox("Please enter the cell address:", "KuTools For Excel", Selection.Address, , , , , 8)If xRg Is Nothing Then Exit SubxFlag = FalseFor Each xShape In ActiveSheet.ShapesIf xShape.TopLeftCell.Address = xRg.Address ThenxFlag = TrueEnd IfNextIf xFlag ThenMsgBox "Image exists!"ElseMsgBox "Image does not exist"End IfEnd SubCopy3. Press the F5 key to run the code. In the popping up Kutools for Excel dialog box, please enter the cell which you want to check if it contains a picture, and then click the OK button. See screenshot:4. Then a dialog box will pop up as below screenshot shown if a picture exists or not in the specified cell.Related Articles:How to automatically change all pictures to move and size with cells in Excel?How to center a picture in an Excel cell?How to insert image or picture dynamically in cell based on cell value in Excel?How to enlarge image when click on it in Excel?Best Office Productivity ToolsTransform 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
