Vba delete picture in cell. ClearContents VBA Clear.

Vba delete picture in cell Delete How can you remove the contents and the formatting of a cell or range in VBA with a single command, without affecting the rest of the worksheet? Sub Test() Dim cell as range, rng as range Dim lRow as long Set rng = Range("C3:C" & lRow) For Each cell In rng If IsEmpty(cell. TopLeftCell) Is Nothing Delete images from a range of cells with VBA code; 17. Value2) Then If InStr(1, cel. Delete Else Exit For End If Next cell End Sub Thank you for helping out Delete picture from a cell using vba. SpecialCells(xlCellTypeBlanks). Pictures If Not Intersect(Pic. There is no need to use a loop. I'm trying to create a Macro to delete all the pictures contained in the selected (highlighted) cells. ' Delete existing pictures within the cell ranges For Each Windows_pic In LT. ClearContents is the same as pressing the Delete key on your keyboard. Sub Insert_Delete_Pic_Front_Page() Application. Range("A1:B12"). Delete Next i end sub Selection. Offset(-1). 1 Delete all images from cells except last one in vba. Cells. Pictures If Not Application. Is there anyway to change the name box of a image or at least get the selected image? Here's my code to put border on image: I am trying to remove all spaces from cells in a specific column. WAY Two (VBA) If you still want to use VBA then simply record a macro for the above. I can insert the image using code similar to the below: ActiveSheet. Pictures Pic. What I meant when I said "clear the names of all named cells within a range" is the same as opening the Names Manager in the Formulas tab, choosing a defined name and deleting it, but for a specific range (A1:G5 in Sheet A). Delete Remove hyperlinks in active sheet Module method: Sub RemoveHyperlinksInActiveSheet() ActiveSheet. Columns(myarray(i)). Add c 'adds a row that is to Dim OBR as Picture For Each OBR In ActiveSheet. Excel VBA - Delete rows when a cell contains a date. I have the VBA code below to crop the five pictures/shapes and it is working fine, but I am not sure how to I have 200 Excel files, always with the same picture and the same picture name. Image = grabpicture End If but here grabpicture variable is an object. Instead of the cell objects used in your (valid) solution, Deleting pictures with Excel VBA. ActivePresentation ' Delete object in slide Set PPSlide = PPPres. Shapes(1). Automating "Place in Cell" for Pictures Inserted in Excel Using VBA or Other Tools latarshac; Nov 30, 2024 VBA Code - Remove link to inserted pictures second attempt, this is being weird and deleting columns that i don't want it to delete. Delete Sheets("Sheet1"). Select, insert and center a photo in the merged cell. The macro has to be used several times and in different Excel files Delete all pictures in a specific range of cells with VBA code. Cells(1, 1) ' Picture displays in cell from row, column Set objPicture = . Then go to the control tab and set the cell link. You could also name the picture you insert using the . Offset(-1)) Then cell. ClearContents Next ' using for loop with an iterator Dim i As Long For i = Remove all Images in Workbook – Other Ways. Solid 'This will set a picture using a path objShape. like this,. Left = gvarImage15Left objPicture. They are set to move and resize along with cells and it works fine (I can copy or cut a cell and paste it with picture inside). 2. What is the code to clear data from a certain cell to the end of the whole document? For example, I have data in D2 and I would like to write code in a button to clear all data from D2 until the very end of the document. Tables(1). ActiveSheet. Pictures. I had a situation where I wanted to delete pictures (In my case charts) from selected cells on a worksheet and leave others in place therefore removing all pictures was not an option. Hi guys, I'm trying to create a Macro to delete all the pictures contained in the selected (highlighted) cells. Select Cells. You can also clear the contents of an entire range of cells: Range("b2:c10"). Select Caddress = Cell. Sub deleteImage() Dim Pict As Shape Dim Cel As Range Set Cel = Sheets("Sheet1"). Sub DeleteAllPics() 'Updateby Extendoffice Dim Pic As Object For Each Pic In ActiveSheet. How you can see in the image, I will have pictures (screenshots) and it cant be deleted, the thing I am trying to delete is the blue The initial code references a concatenated picture lookup address in for pictures on my computer in sequential order for a process. Select Selection. Intersect(ActiveSheet. Show default I have some cells that contain pictures. I want the user to be able to delete each row by clicking each of the remove texts. I have 15 images in my sheet out of which one image i needs to replace. Worksheets(“Sheet1”). Selecting Image in Excel VBA. Unfortunately, I don't see how to do this. ScreenUpdating = False directory = "C:\Users\" fileName = Dir(directory Private Sub Worksheet_Activate() Application. On this worksheet I have another images, so I can't use code like this: ActiveSheet. Shapes I have a command button on the page to clear (reset) the sheet; but, I don't want to clear all imagesjust the images that were imported. Range("F12") Dim Caddress As String Caddress = Cel. I 've below code, but it does work only for one cell. g. Delete Next For a specified cell in a sheet. Range("b2"). how to clear a picture content control with macro in ms word. Clipboard. VBA Clear Formatting. Top = gvarImage15Top objPicture. 0 Delete specified image with Excel VBA. You can use the inbuilt method. Open the worksheet where you need to check if a picture exists in a specific cell, then press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window. You need to select the picture itself. Value = LTrim(cell. Clear. Pictures With pic s = . Steps: Enter the Image_Name (Argentina), Image_Location on the computer (E:\ExcelDemy\National Flags), Image Format (. Hyperlinks. Delete Shift:=xlUp End Sub excel vba This deletes all the pictures in the worksheet. Cell(1, 2). Pictures are stored in the Pictures collection under a worksheet object. Parent. Commented Jan 6, 2016 at 16: Use this macro to remove any empty lines inside all cells: Sub TrimEmptyLines() Dim cel As Range, s As String, len1 As Long, len2 As Long For Each cel In ActiveSheet. I have looked in several places here, and other, to no avail. Excel: Use VBA to delete rows within a specified date range The code below will center an image within a cell, given that you know both the name of the image and the cell that it is located in. In addition, it will delete the cell values from the first cell to the last cell of the worksheet. Remove pictures in defined area. I am trying to delete the first occurrence of "<" and ">" in a cell without losing formatting of the remainder of the cell's contents. The below VBA code can help you check if a cell contains a picture. Pictures 'Check for each picture in the range If Pict. VBA: How to check IF a specific cell contains an image and then delete the image if it exists. This way you can delete a specific picture. Column Y Remove Remove Remove Remove. I came across a solution Let us show you how to make Excel delete all pictures automatically using VBA. Also see the MsoShapeType Enumeration. How to crop an image with VBA to a specific form e. I would like to resize the image so that it has a width of 350px, while maintaining its aspect ratio. Here’s an example: Sub DeleteSpecificPicture() Dim pic As Shape Set pic = ActiveSheet. Sub sbDelete_Columns_IF_Cell_Is_Blank() Dim lColumn As Long Dim iCntr As Long Dim i As Integer Dim f As Integer i = 4 f = 100 lColumn = 103 For iCntr = lColumn To 1 Step -1 If IsEmpty(Range(Cells(f, i), (Cells(f, i)))) = True Then Columns(iCntr). Here is the Excel VBA macro to Delete a range. Delete End Sub Any help on this would be kindly appreciated. AddPicture Filename:="image. I always do that when I insert a picture. Use ' Set the named range where you want to insert the picture Set TargetRange = ws. Sheets ws. If your button is a Form Control (msoFormControl) or an ActiveXControl I wonder why are you using VBA for such a simple task. IsError(Cells(i, 10)) Then Cells(i, 1). Here's a sample code you can use: Sub Delete_Pictures_ByName() Dim shp As Shape Dim picName As String picName = "picture 1395" ' change this to the name of the picture you want to delete For Each shp In ActiveSheet. jpg") Reference: FillFormat Members (Word) I have a statement with Image Dynamically In Cell (fom I11 to I19) I usually only use 2 or 3 lines, so the other 7-8 are empty. Shapes 'Check for each picture in the range If Pict. When I googled it, I couldn't find it either. Address 'Assign the range For Each Pict In ActiveSheet. Delete MsgBox ("Image deleted") Application. Delete End Sub Immediate Window method: Selection. This should delete only the row which the user has clicked remove for, aka the target row. I know the location of that image i. Name <> "Picture2" Then shp. VerticalAlignment = xlBottom . Excel VBA - If condition on image. HorizontalAlignment = xlGeneral . ShrinkToFit Link each checkbox to the corresponding cell in D. See how to use loops these are just 3 simple loops examples ( all 3 are doing the same thing ) for you to better understand how loops work. For example, link the one in C3 to cell D3. Row To 1 Step -1 If worksheetfunction. Count, 2). Running this code on a simple example (on "Sheet1" in this picture) that looks like this: Will delete all rows with a date older than 1/1/2013, giving you this result: Share. Is anyone familiar with a dynamic loop that will search a single VBA Excel Align Pictures Horizontally in Multiple Rows. Cropping image after pasting it into Excel. I want to delete one picture msword using macro The sample code is below, I am new with but not working Dim myImage As Shape Set myImage = ActiveSheet. Pictures ' For Each cell In cellRange Debug. The VBA code for removing pictures from a worksheet involves identifying the picture object and using the . Domenic. This is what I am trying to do: Say "A1" contains the text: "This is <a> long string with several <occurrences> of a <special> character. Range("A11:M54") If Not Application. how to update a cell from an image object. I haven’t found a way to delete pictures in specific Cells without using VBA, so I believe VBA is the way to go. i could find a code like this : If My. Locked; Question; To answer the question How to delete specific columns in vba for excel. ContainsImage() Then Dim grabpicture = My. Hi anyone, How could I modify the following code so that it deletes active cell from range C14:C26?Sub Delete() ActiveCell. " Method 1 – Inserting a Single Image into a Cell using Excel VBA. 'This will clear the existing picture objShape. I believe that once you have the cell selected you can get the picture object from the ShapeRange collection. Pictures If Not Intersect(OBR. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window. Delete). Picture doesn't get inserted into the Excel file (but only as a reference) 1. Both the above codes will delete the entire worksheet “Sheet1” data. The macro has to be used several times and in different Excel files consequently the cell's references change every time. Delete If you determine that the expected image is not in the Shapes collection, then it is possible that Excel (for strange reasons only known to Excel) moved the image to a different collection, such as the Pictures collection. Value2) Do ' remove duplicate vbLf len1 = Len(s) s = Replace$(s, vbLf & vbLf, vbLf) You can use VBA to delete all pictures with a specific name in your Excel inventory. Dim i As Long For i = Cells(Rows. cells N21, P21, S21, U21 & W21. According to this question on SO, the Pictures collection is undocumented. TopLeftCell. Clear I have a series of large Microsoft Excel 2010 spreadsheets with images in them, and I need to remove 2/3 of those images. Option Explicit Private Sub CommandButton1_Click() ' Purpose: Change view between given image and no image Dim sImgName As String ' picture name string sImgName = "C:\Temp\MyPicture. Hi Strat54: Adding to the approach suggested by Taz, if you want to delete all three pictures in one go, then use the Select Object icon (the North-West pointing arrow, next to the Draw Button on the Drawing tool bar to demark an area covering all the pictures (and/or drawing objects) and all the objects in the demarkated area will get selected -- now press the I am using the following VBA Macro to delete all the pictures in a PowerPoint slide: Public Function delete_slide_object(slide_no) ' Reference existing instance of PowerPoint Set PPApp = GetObject(, "Powerpoint. circle in PowerPoint? 0. gif"" ' <<< choose your picture name" With Me. Delete End Sub I have been trying to delete ONLY the pictures (and ideally, the added shapes) in a worksheet using this code I found in another thread here: Sub DeletePic() Set ws = ActiveSheet Set Rng = ws. Width = gvarImage15Width objPicture. Delete which deletes the entire cell! The former is the equivalent of selecting a cell and pressing the Delete key (which clears the contents but leaves the cell in place). VBA Code - Remove link to inserted pictures Spaztic; Apr 29, 2024; Excel Questions; Replies 5 Views 859. Intersect(TargetRange, Pic. Here is what i've got that doesn't With VBA in Excel, you can create a macro that allows you to insert pictures into a cell or a range of cells. Shapes("Picture 1") myImage. The problem I have is when I delete an entire row (right click on the row and delete), in this situation the image from the row I'm deleting jumps down and hides behind the image on the next row. TopLeftCell, ActiveSheet. All the images I need to remove contain the same string of characters in the title, "Err". Then the macro will delete it automatically. Address For Each Pict In Sheets("Sheet1"). ScreenUpdating = This all works fine. OnKey "{DELETE}" End Sub Now according to what I read, this will in turn make the delete key useless so I also need it to clear the currently active cell at the same time, I found this: This returns a FillFormat object which is used to add or remove Pictures. EntireColumn. UserPicture ("C:\Users\Public\Pictures\Sample Pictures\Lighthouse. Type. WrapText = False . Without an add-in there are two ways to remove all images from an Excel Workbook: Repeat the steps outlined in the first section for each worksheet in your Excel file. Clear One solution is to store all the rows that are to be deleted in a Collection, and then delete the collection afterwards. I used this to show a picture based on a value in a field. Create a named range using this formula (adjust sheet names to VBA code does the following. Sub findImage(Cell As Range) Dim Caddress As String Dim Pict As Excel. The images display correctly just in the cell as required. ClearFormats. F5, I want a macro to determine if there is a picture on top of that cell, and if so to delete that picture. Orientation = 0 . Address = Caddress Then 'if exists in the range shows a message MsgBox "The image exists!" You'll see a picture of the cell you originally clicked on within a picture frame that you can rotate and resize. Thanks, MikeG ActiveSheet. Try the following code: How do I delete a specific picture in a range of cells using VBA? To delete a specific picture in a range of cells using VBA, you’ll need to know the name of the picture or its index number. Select B4. Shapes If shp. Delete all pictures in a worksheet or whole workbook with Kutools for Excel. The picture frame on the reporting sheet will now display whichever picture is in the cell you clicked on. Hot Network Questions I am working on a VBA code and part of the code is needed to delete all the rows in the sheet where the text in the column "J" is "#N/A". 1 VBA: How to check IF a specific cell contains an image and then delete the image if it exists. Is there a way to find and delete images by partial name? ActiveDocument. Address & When you loop through your delete code, you can pass the row and the array to a function that will check to see if there is a pic in that row, and if there is, delete it (using pic. Application") ' Reference active presentation Set PPPres = PPApp. Range("A11:M54")) Is Nothing Then ActiveSheet. I have a case where I need to delete a picture that is inside a specified, single cell (when a condition is met). Shapes If pic. NB. – The picture at that cell (B16) is selected by VBA. IndentLevel = 0 . Paste your two pictures into the cells on the blank worksheet. For example Check if a cell contains picture with VBA code. I have a VBA macro that goes for an image in a file and sticks it into an Excel spreadsheet, in a worksheet called "Country Profile". Shape. Type = msoPicture Then Do you want to delete all pictures in the range A1:L7 or only the ones in A1:L1 ? Dim s As Shape, rng As Range. AddIndent = False . Delete End If Next Pic By the way, 'Pic" can be I think the solution is to put some code at the beginning that can select the images in the cell range and delete them, before the new data is imported. In this example , we are deleting the range and shifting the cells towards up. You can check the Shape. Delete Remove hyperlinks in Method 3 – Running a VBA Code to Insert a Picture from a Folder Based on a Cell Value In B4, create a Dropdown list with 4 coffee items- coffee1, coffee2, coffee3, and coffee4. Range("A5:F500") For Each pic In ActiveSheet. Remove Text: Write the VBA code to remove images in Excel? Easy! Follow these steps: Open the Visual Basic Editor with “Alt + F11” (Windows) or “Option + F11” (Mac). Image1 If . 0. text, vbLf) > 0 Then s = Trim(cel. Value) ' Picture path row, column objPicture. Shapes("Signature"). Insert(FilePath) Pic. TopLeftCell, Range("A1:O30")) Is Nothing Then Pic. 3. Computer. (Source: Stack Overflow) Pictures in a worksheet can be removed I want to delete different image (I copy image to this cell, using VBA code, so each image have another name), on merged cells (I don't want to unmarged cells). Before inserting the new picture, delete the old one using the same name "any_name ". The following is a solution that uses (calls) the deletePictureFromCell procedure. Excel Macro VBA - Check if Image is in Cell. I can sort the cells successfully also and the images get moved correctly. Sub Image15() Dim objPicture As Picture With Sheet4. If you want to use For Loop to loop through each object, you have to use Shapes. If you want to delete the present sheet cells, you can use the Active Sheet object. How to write VBA programme to delete shape in specific range and not in all sheets. When you insert the new picture you give it a name, for example "any_name ". Shapes. "A201:I230" So how can delete the shape/image in that range before I insert new image. This means that we I haven’t found a way to delete pictures in specific Cells without using VBA, so I believe VBA is the way to go. Adjust picture width and height. e. I want to paste an image from clipboard to an excel cell using vba. Clear Now I no longer want/need that picture so I'd like to remove it. . I tried it like this: Sub Clear_Images() Dim directory As String, fileName As String ', sheet As Worksheet, i As Integer, j As Integer Dim wks As Worksheet Dim myPict As Shape Application. Shapes("Picture 1") pic. ; Go to the Data tab and select Data I need help with the following problem: How can I clear a cell filled color by specifying range or infinite range in Excel VBA instead of using UsedRange to clear filled color? Worksheets("Sheet2"). The code below works, but only when the picture is specifically named "Picture 179" which it won't be ever again or at least until the counter recycles. I'm using the following code which still seems to delete every image: For Each shp In ActiveSheet. GetImage() PictureBox1. Set rng = Range("A1:L7") For Each s In ActiveSheet. End(xlUp). FileExists method to check if the path is good before executing the previous command Set Shp = wsDestination. pic In ActiveSheet. Sub Delete_Range_To_ShiftUp() Range("B2:D10"). I appreciate it. Delete Next i – Mohammad Imran. How to select multiple pictures on Excel and changing them with VBA. if you actually have the need to eliminate the leading spaces (the ones preceding the first not blank character) leaving all other ones in place, then you have to loop and use LTrim() VBA function: Dim cell As Range For Each cell In Range("B1", Cells(Rows. Insert(Sheet4. You can do this by right-clicking on the checkbox and choosing "format control". Lets say we want to delete pictures in specific Cells, only pictures in Range E2:E9. The images I need to keep do not contain that string of characters. Delete or ActiveSheet. UsedRange If Not IsError(cel. Cells(2, 51). also when i insert a new picture in a different cell the previous picture gets deleted which i I'm trying to insert a picture into a worksheet using VBA, that I can later reference by name (to for example delete, or hide). png) Enter the Cell_Reference (C3) of the image on the worksheet in the code. Name, Windows_pic I am processing five pictures (printscreen shape) and would like to place them in selected cells, eg. Delete picture from a cell using vba. May 2, 2024. Deleting images but can't avoid deleting command button. Deletes previous image in the cell where the image was pasted. here is this code: Sub Macro1() ' ' Macro1 Macro ' ' Keyboard Shortcut: Ctrl+m ' With Selection . Delete Delete Picture From Cell. Now when you check and uncheck the checkbox, this cell will change to TRUE or FALSE. The field had a formula that resulted in either "good" or "bad". I use Array as below. VBA code: delete all pictures in a selected Alternatively i could make do with a button that runs a bit of code. Picture Application. Type = msoLinkedPicture Then Problem is, if there are two images in the worksheet that is "Picture 1", the function will get confuse and not know which one to put it on but randomly put it on a image which could be incorrect. Note: If you already have an image on the sheet, you will need to delete it manually for the first time. Hot Network Questions What You aren't able to adjust the picture if you have the cell selected. OnKey "{DELETE}", "Intercept" End Sub Private Sub Worksheet_Deactivate() Application. 'data Cells. Slides(slide_no) For As you can notice in the VBA code, DrawingObjects have Delete Method, but not Shapes. My idea is that it would start as something like this: Range("D2", `<i>whatever the end function is</i>`). Range("I17:I I need to delete only the shapes which are located after row 15, and shapes which have Resize and Clear All written on it. WAY One (NON VBA) Press CTRL + H to bring the Find and Replace Dialog Box and use that to replace the text. Clear will clear all cell properties from a cell: Range("b2"). Here is a simple VBA code can help you to delete the images in selected range For Each Pic In ActiveSheet. To clear cell formatting use ClearFormats. Delete excel rows based on latest date. name = "pic15" ' Trying to see if I can delete Here is a simple VBA code can help you to delete the images in selected range without deleting them one by one, please do as this: 1. 1 Delete all images in the selected range before inserting a new image Select a picture from file using a button and insert it in an excel current cell and resizing the cell to fit the picture using vba. Volatile Sheets("Sheet1"). In cell E2, use the formula: Sub CopyValuesAndPictures() ' Define variables Dim pictureSheet As Worksheet Dim currentSheet As Worksheet Dim pic As picture Dim targetCell As Range Dim bCell As Range ' Set the sheets Set currentSheet = ActiveSheet Set pictureSheet = Sheets("Customers Contacts Images") ' Clear existing pictures and values in column I currentSheet. Picture Is Nothing Then ' picture property has been cleared already . Ask Question Asked 4 years, 8 months ago. EDIT: Since this is more complex than usual, and you're new to VBA, here's a more concrete sample: If you want to do both, you can use . Delete Shift:=xlToUp End Sub VBA to Delete Range in Excel – Example Excel VBA crop picture/shape and put in cells. Modifies a Link with Data, then returns Image (the link) and pastes in onto a worksheet. Delete method. Here we are deleting range “B2:D10”. Value) Next Ricardo and Knee - thanks for the replies and thinking about a different approach. Sheets("Test"). Print Windows_pic. Value, " ", "") Next i It does eliminate the space but it also eliminates a comma. EntireRow. Count, 10). I would like VBA not to insert an image if cell D11 to D19 is empty. Here is my code: Sub delete_empty_cells() Sheets("Incidents_data"). However, I couldn't use your solution because I also need to be able to sort the columns in each worksheet once populated, which means each row of formulas requires absolute references that remain connected with the same cells after sorting has changed their order Regarding your comment "the SpreadSheet I am talking about has usualy about 30 images (Pictures) but also two Bottons that I do not want to erase, I do not know how to differenciate (sic) them". Private Sub CommandButton2_Click() ' using for each loop Dim ws As Worksheet For Each ws In ThisWorkbook. In fact the previous VBA also can't work at B16 only. The latter is the equivalent of right-clicking a cell and choosing "Delete cells" (which deletes the cell). I copy new links with the formula as more pictures are generated, which is quick, simple, and easy, and is why I want to keep the "OnMouseOver" function of the initial code, so I can copy this easily to new cells. Delete Delete picture from a cell using vba. D. e. Delete End Sub Immediate Window method: ActiveSheet. ScreenUpdating = False Dim rng As Range Set rng = ActiveSheet. Name = "myPicture" 'Strongly recommend using a FileSystemObject. UsedRange. 3. Range("A1:C3"). Value = Replace(Cells(i, 17). Delete Next Pic End Sub 4. Name property. The shapes are a rectangle: rounded corners keeping text and having a macro assigned . SelectAll Selection. Delete, but then the other cells in the spreadsheet shift to replace the deleted cells. Picture = LoadPicture(sImgName) Else Sub Insert_Pic_From_File(PicPath as string, wsDestination as worksheet) Dim Pic As Picture, Shp as Shape Set Pic = wsDestination. Delete End VBA to Delete Range in Excel – Example:Shift:=xlToUp. Delete images from active sheet, selected sheets, all sheets with a handy feature VBA code: Delete all pictures from current worksheet. 1. Delete End If Next OBR Unfortunately it is not working - code stops on For Each OBR In Here is a solution using the Visible property of the object. My macro command works fine in cells that are filled, but for empty cells it also inserts an image that says "The linked image cannot be displayed". Click Insert > Module, and paste the following code in the Module Window. End(xlUp)) cell. jpg", linktofile:=msoFalse, _ savewithdocument:=msoCTrue, Left:=10, Top:=20, width:=100, Height:=50 One more thing you create macro and use shortcut key (ctrl + m) so you can select cells that you want merge and clear also. ClearContents does not work Delete picture from a cell using vba. In the Properties, under Picture, I can only re-browse for another picture. Clear For i = 1 To 15 Cells(i, 1) = Int(Rnd * 4) Cells(1, i + 2) = Cells(i, 1) Next i 'code Dim tbd As New Collection 'to be deleted collection For Each c In [a1:a15] If c = 1 Then tbd. Delete Sheets(1). Excel - Deleting images when deleting a row. Delete specified image with Excel VBA. Excel VBA delete all pictures in specific Cells. Please do as follows. ClearContents VBA Clear. Delete all images in the selected range before inserting a new image. Thanks in advance I have images in cells which are same so I want to delete all except last one (keep only one). The image is inserted at Cell A45 specifically but it extends through roughly cell AZ60. sub del_col() dim myarray as variant dim i as integer myarray = Array(10, 9, 8)'Descending to Ascending For i = LBound(myarray) To UBound(myarray) ActiveSheet. Fill. TopLeftCell, Range("B2:B7")) Is Nothing Then OBR. I found this question,which has an answer:How to remove spaces from an entire Excel column using VBA? This is how I adapted the answer: For i = 2 To n Cells(i, 17). Range("PictureHere") ' If the named range "PictureHere" exists, insert the picture If Not TargetRange Is Nothing Then ' Delete any existing picture in the named range For Each Pic In ws. Read on to find out all about it! How to Insert a Picture Into a Cell Using VBA in Excel In order to create a macro to insert pictures into Excel cells using VBA, you actually don't need any advanced Visual Basic knowledge.