We help IT Professionals succeed at work.

Why does Used Range select 1,000,000 rows

When I use the below used range it selects over 1,000,000 rows ?  Why as I only have 5 rows of data...I even manually deleted row6+ and all Columns beyond COl D and still no luck..

Worksheets("Sheet1").Activate 
ActiveSheet.UsedRange.Select

Open in new window

Comment
Watch Question

After deleting the rows and columns, save, close and reopen your workbook.
"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
Do something like this, changing the range as needed.

Sub MakeWorkbookSmaller()
ActiveSheet.Range("A2761:DJ1048576").ClearFormats
End Sub

Open in new window

Author

Commented:
Perfect...thanks everyone
Martin Liss"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
              Experts Exchange Top Expert VBA (current)