How to delete infinite columns in excel
Tutor 5 (273 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To delete the appearance of “infinite” unused columns and shrink the workbook’s used range, remove every column to the right of your actual data. Follow one of these reliable methods.
Quick delete by selecting to last column (Windows)
-
Click the header of the first empty column to the right of your data (for example, if your last data column is G, click H).
-
Press Ctrl + Shift + → (Right Arrow) to extend the selection to column XFD (the last column in modern Excel).
-
Right-click any selected column header and choose Delete.
-
Save the workbook, close Excel, then reopen the file to let Excel recompute the used range.
Quick delete by selecting to last column (Mac)
-
Click the header of the first empty column next to your data (for example, if your last data column is G, click H).
-
Press ⌘ (Command) + Shift + → (Right Arrow) to select through the last column.
-
Control-click (or right-click) any selected column header and choose Delete.
-
Save, close, and reopen the workbook to reset the used range.
Delete using the Name Box (alternate, works on Windows & Mac)
-
Determine the first empty column letter (for example, H).
-
Click the Name Box (left of the formula bar), type
H:XFDand press Enter. -
Right-click any selected column header and choose Delete.
-
Save and reopen the workbook.
Use VBA to remove every column after the last used column (Windows & Mac)
-
Press Alt + F11 (Windows) or Option + F11 (Mac) to open the VBA editor.
-
Insert a new module and paste this macro:
Sub DeleteColumnsRightOfUsed()
Dim ws As Worksheet
Dim lastCol As Long
For Each ws In ThisWorkbook.Worksheets
On Error Resume Next
lastCol = ws.Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
On Error GoTo 0
If lastCol < ws.Columns.Count Then
ws.Range(ws.Columns(lastCol + 1), ws.Columns(ws.Columns.Count)).Delete
End If
Next ws
ThisWorkbook.Save
End Sub
-
Run the macro.
-
Close and reopen the workbook.
Reset used range without deleting columns (copy-to-new workbook)
-
Select the whole block of real data (exclude blank columns to the right).
-
Press Ctrl + C (Windows) or ⌘ + C (Mac).
-
Open a new workbook and paste the data.
-
Save the new workbook. This produces a file with a properly sized used range.
Why does Excel look like it has infinite columns
-
Modern Excel versions have a fixed column limit: 16,384 columns (A through XFD).
-
Excel stores a workbook’s used range; orphaned formatting, stray cells, or deleted data beyond your last real cell can make Excel treat far columns as “used.”
How to check and reset the used range
-
Press Ctrl + End to jump to the last cell Excel thinks is used.
-
If that cell lies far beyond your data, remove stray formatting or follow one of the delete methods above, then save/close/reopen to reset the used range.
Risks and what to watch for
-
Deleting columns may break formulas that reference whole columns (e.g.,
SUM(H:H)). -
Named ranges, pivot tables, charts, or macros may refer to columns you delete.
-
Back up the workbook before bulk deletes.
Best practice to avoid “infinite columns.”
-
Keep data in clearly bounded ranges or convert ranges to an Excel Table (Insert → Table).
-
Avoid applying formatting to entire columns.
-
When cleaning a file, save a backup and check formulas and named ranges after the cleanup.
What if I cannot delete the columns, or the selection keeps reverting?
Try this checklist:
-
Check for worksheet protection and unprotect the sheet.
-
Inspect for merged cells spanning into the area you want to delete and unmerge them.
-
Remove conditional formatting or cell styles applied to entire columns.
-
Use the VBA macro above to forcibly delete columns after the last real column.
Are there differences between Windows and Mac?
Yes.
-
Keyboard shortcuts differ: Windows typically uses Ctrl while Mac uses ⌘ (Command).
-
The VBA code is identical across platforms, but opening the VBA editor uses Alt + F11 (Windows) and Option + F11 (Mac).
-
Right-click behavior can vary by mouse/trackpad settings on Mac.
Final quick recommendation
Use the select-first-empty-column → Ctrl/⌘+Shift+Right → Delete → Save → Close → Reopen flow for the fastest safe result. Use the VBA macro for multiple sheets or repeated cleanups. Back up the file before making bulk changes.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to sort by highlighted cells in excel
Answers · 1
How to sort excel by column and keep rows together
Answers · 1
How to sort by time in excel
Answers · 1
How to sort alphabetically in excel by last name
Answers · 1