I have huge worksheets, several thousand rows each. Most recent information is in the last row, and I use Ctrl+End to get there. After deleting unnecessary information worksheets shrink to several hundreds rows. But even after saving worksheet, Ctrl+End still points to the old, now empty row well down below actual end of data. The only workaround I know is to copy everything to the new worksheet, but it is very time consuming to me. Any ideas?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Ctrl+End Behaviour (Excel 97 SR2)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Ctrl+End Behaviour (Excel 97 SR2)
- This topic has 6 replies, 5 voices, and was last updated 23 years, 10 months ago.
Viewing 2 reply threadsAuthorReplies-
WSAndrew Cronnolly
AskWoody LoungerJuly 1, 2001 at 3:42 pm #531555 -
WScri
AskWoody LoungerJuly 2, 2001 at 3:52 pm #531645I use this macro as work-around, can be modified easily to become a public function:
Sub RealLastCell()
‘Work around for the Ctrl+End ‘selects rightmost corner _or!_ formatted cell’ bug
Dim nLastRow As Long, nLastCol As Integer
With ActiveSheet
nLastRow = .Cells.Find(what:=”*”, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
nLastCol = .Cells.Find(what:=”*”, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
.Cells(nLastRow, nLastCol).Select
End With
End Sub -
WSsteve69
AskWoody LoungerJuly 2, 2001 at 11:13 pm #531700Will this procedure just reset lower_rightmost corner? Is there additional code that could be added to delete all unused colums and all unused rows? For example if my data occupies the range (“A1:J499”), then I make adjustments to the data and it now occupies the range (“A1:I375”), could your code select columns J thru IV and delete, then select rows 375 thru 65536 and delete, then reset the lower_rightmost corner to (“A1:I375”)?
Just curious as I run into this alot.
-
WScri
AskWoody LoungerJuly 3, 2001 at 3:26 pm #531774Well, it should be feasible:
a) Is manual triggering ok ? Sometimes the events become events…
What shall happen with the empty ‘leftmost’ columns and with the empty ‘top’ rows ? I know your example does not have them, but what would you expect the routine to do if you happen to have them ? I always try to make my macros as general as possible.
c) Where do you want the selection point after the execution ?
-
WSsteve69
AskWoody LoungerJuly 4, 2001 at 2:47 am #531835In answer to your questions:
a) Is manual triggering ok ? Sometimes the events become events…
Manual is great, I was thinking of being able to activate from a menu.What shall happen with the empty ‘leftmost’ columns and with the empty ‘top’ rows ? I know your example does not have them, but what would you expect the routine to do if you happen to have them ? I always try to make my macros as general as possible. is it possible to ignore them? If not possible to ignore, any suggestions?
c) Where do you want the selection point after the execution ? How about the lower_bottom_right corner?
-
-
-
-
WSgwhitfield
AskWoody LoungerJuly 4, 2001 at 10:55 am #531843The site does compress leading blanks- if you post it as straight text. Just like any straight HTML.
But tere is a way to display it as code. See this post for an explanation on how to format code for the forum.
Here’s your code again, formatted. With a few line splits to make it look nice on the forum.
Sub ClearFormatsAfterRealLastCell() 'Work around for UsedRange includes cells with non standard formatting Dim nRealLastRow As Long, nUrLastRow As Long Dim nRealLastCol As Integer, nUrLastCol As Integer, iSave As Integer Dim sDlgTitle As String sDlgTitle = "Macro ClearFormatsAfterRealLastCell" With ActiveSheet 'Check whether worksheet is protected If .ProtectContents = True Then MsgBox "Please unprotect sheet '" & .Name & _ "' first, then re-run this macro." Exit Sub End If 'Determine 'RealLastCell' and the 'CtrlEnd' cell With .Cells nRealLastRow = .Find(what:="*", SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious).Row nRealLastCol = .Find(what:="*", SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious).Column With .SpecialCells(xlCellTypeLastCell) nUrLastRow = .Row nUrLastCol = .Column End With End With 'Jump to RealLastCell .Cells(nRealLastRow, nRealLastCol).Select If nUrLastRow > nRealLastRow Or nUrLastCol > nRealLastCol Then iSave = MsgBox("Operation can not be undone. Save workbook now ?", _ vbYesNoCancel, sDlgTitle) If iSave = vbCancel Then Exit Sub If iSave = vbYes Then .Parent.Save 'Clear surplus formatting where required, 'safer than deleting cells, its still Microsoft If nUrLastRow > nRealLastRow Then .Rows(nRealLastRow + 1 & ":" & nUrLastRow).ClearFormats End If If nUrLastCol > nRealLastCol Then .Rows(nRealLastCol + 1 & ":" & nUrLastCol).ClearFormats End If 'Save it in order CtrlEndCell becomes the RealLastCell iSave = MsgBox("'Surplus' cell formats were cleared. Save workbook now ?", _ vbYesNo, sDlgTitle) If iSave = vbYes Then .Parent.Save Else MsgBox "There are no formats after the selected 'Ctrl+End' cell", _ vbInformation, sDlgTitle End If End With End Sub
Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Giving UniGetUi a test run.
by
RetiredGeek
7 minutes ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
7 hours, 45 minutes ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
5 hours, 43 minutes ago -
Auto Time Zone Adjustment
by
wadeer
12 hours, 14 minutes ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
9 hours, 54 minutes ago -
Manage your browsing experience with Edge
by
Mary Branscombe
3 hours, 41 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
1 hour, 25 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
5 hours, 42 minutes ago -
Apps included with macOS
by
Will Fastie
5 hours, 20 minutes ago -
Xfinity home internet
by
MrJimPhelps
5 hours, 15 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
5 hours, 13 minutes ago -
Debian 12.11 released
by
Alex5723
1 day, 9 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
1 day, 13 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
16 hours, 30 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
8 hours, 54 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
2 days, 5 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
1 day, 20 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
2 days, 8 hours ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
2 days ago -
Some advice for managing my wireless internet gateway
by
LHiggins
1 day, 8 hours ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
10 hours, 25 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
2 days, 18 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
6 hours, 14 minutes ago -
Does windows update component store “self heal”?
by
Mike Cross
2 days, 4 hours ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
3 days, 8 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
1 day, 16 hours ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
1 day, 4 hours ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
3 days, 10 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
3 days, 10 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
1 hour, 12 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.