Delete Every Other Row or Column in Excel (using Formula or VBA)

Today we are going to explore various ways to delete every other row or delete every other column in Excel. VBA macro code is included to help you on your way if that is the path you choose.

Additionally, we will also cover how to delete every third/fourth/fifth row or column in Excel.

To delete alternate rows, you can use a helper column and use a formula that helps you identify alternate rows. This could be done by using the ISEVEN function that checks each row number and returns TRUE if the row is even and false if it isn’t.

Once you have this, you can easily filter the rows with FALSE in the helper columns and delete these.

In case you want to delete every third row, you need to use the MOD function to identify every third row. Once you have it, you can easily filter and delete every third row or every fourth row.

I also cover a method to use a simple VBA code to delete alternate rows in Excel.

Below is that VBA CODE TO DELETE ALTERNATE ROWS:

Sub Delete_Every_Other_Row()
Dim Rng As Range
Set Rng = Application.InputBox("Select the Range (Excluding headers)", "Range Selection", Type:=8)
For i = Rng.Rows.Count To 1 Step -2
If i Mod 2 = 0 Then
Rng.Rows(i).Delete
End If
Next i
End Sub

When it comes to deleting alternate columns, you cannot filter these. You can instead sort and bring all those columns together that you want to delete.

I cover a simple method that uses the MOD function to identify alternate columns and then sort these from left-to-right to bring these together. Once you have these in one place, you can select and delete these.

And there is also a VBA code that you can use to delete alternate columns.

Below is the VBA CODE TO DELETE ALTERNATE COLUMNS

Sub Delete_Every_Other_Column()
Dim Rng As Range
Set Rng = Application.InputBox("Select the Range (Excluding headers)", "Range Selection", Type:=8)
For i = Rng.Columns.Count To 1 Step -2
If i Mod 2 = 0 Then
Rng.Columns(i).Delete
End If
Next i
End Sub

Subscribe to this YouTube channel to get updates on Excel Tips and Excel Tutorials videos – https://www.youtube.com/c/trumpexcel

You can find a lot of useful Excel resources on the following site: https://trumpexcel.com/

#Excel #ExcelTips #ExcelTutorial

View on YouTube

code execution vba

Code Execution Has Been Interrupted- VBA Keeps Breaking – Solved!

How to stop code execution has been interrupted error in Excel VBA.

My Excel VBA Keeps Breaking: A “code execution has been interrupted” keeps coming up, but my Code is Not “Broken”

It’s 2025 and this is still happening, so I just have to share this handy trick.  Sometimes when I’m running VBA code in Excel, it starts getting wonky.  The Break/Debug window keeps popping up during execution, for no good reason.  Code execution has been interrupted, over and over.    The code has run perfectly fine in the past, perhaps hundreds of times.  It’s almost as if something is stuck and hanging in the background.  Restarting Excel does no good.  It seems that the VBA interface itself needs a reset, but clicking reset does nothing.  It’s quite frustrating.

There is a Solution!!

code execution has been interrupted window

When you receive the code execution has been interrupted pop-up,  click Debug.

Then press Ctrl+Pause/Break twice.

Click on the Green Arrow or press F5 to resume.

You should be good to go, as long as there is nothing inherently wrong with your VBA code!

I’m not sure how or why this works,but it does. I think there may be some sort of bug in Excel, so hopefully it will be fixed at some point.  I hope this helps you as much as it has helped me!  Simple solutions sure are the best!

Comment below and let me know if there are other issues you would like me to solve!

Save

Top 5 Copy Paste Functions in Excel – Values, Formatting, Special and More!

Top 5 Copy Paste Functions in Excel – A Detailed Guide

The copy and paste functions in Excel save time and effort, since there’s no need to retype information that already exists.  In  this post,  I will cover and explain the different copy and paste operations that Excel offers.

There are a million reasons under the sun to copy and paste in Excel.  You may want to duplicate information in one column, another sheet or even another workbook.  Perhaps you are copying and pasting data from another source, such as MS Access, your web browser, or a PDF document.  Maybe you are moving data around within a worksheet or workbook.

Copy vs. Cut in Excel

When you select copy within Excel, you are telling the program that you would like to duplicate the information.

When you choose cut in Excel, you remove the data from where it currently exists, and place it elsewhere.

How to Copy

To begin, you must select the data that you would like to copy.  This will move the source data to the clipboard, which is a temporary holding place in the background.

Highlight the data.  To copy using the mouse, right click, and select the copy option.   You may also use the keyboard shortcut – Ctrl + c.  Click in the destination cell.

Paste Options Explained

Copy Paste Special
Copy Paste Menu in Excel

PastePaste – If you would like to paste your data as is, with no changes, right click and select this icon.

Excel ValuesPaste Values – If you’re copying a formula, but only want to paste the results, select this icon, with the numbers.

Excel Paste Formulas Paste Formula – Say you wanted to paste just a formula or set of formulas, you would choose the option with the “fx” in the icon.  Note that depending on what the formula is doing, the result may be different from the original.

Excel Transpose PastePaste and Transpose – The transpose option allows you to change the orientation of your data.  Let’s say you had four items listed vertically.  Using the transpose option would allow you to paste the items horizontally, or vice versa.

Excel Formatting PastePaste Formatting – Excel gives you the option of pasting the formatting only.  If you had some nice shading, or conditional formatting and wanted to copy that, but not modify the formula or data of the target cell or range, then paste formatting would be the option to choose.

Excel Link PastePaste Link – You can simply paste a link to, or reference to the source as a formula or formulas if you are copying multiple cells.  Hint: If you are copying only one cell, by default, the reference will be absolute.  This means that you can move the formula around, but the cell(s) it is pointing to will not change.  When copying multiple cells, the result will be relative references.

 

Save

Save

Save

Save

Save