Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ctrl+End is not always give you the good result
I use a function to find the last row and column with data You can use something like this then for the activesheet Application.Goto ActiveSheet.Cells(LastRow(ActiveSheet), Lastcol(ActiveSheet)), scroll:=True Function LastRow(sh As Worksheet) On Error Resume Next LastRow = sh.Cells.Find(What:="*", _ After:=sh.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Row On Error GoTo 0 End Function Function Lastcol(sh As Worksheet) On Error Resume Next Lastcol = sh.Cells.Find(What:="*", _ After:=sh.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Column On Error GoTo 0 End Function See this page also http://www.contextures.com/xlfaqApp.html#Unused -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Cathy Myers" wrote in message ... Hi, Is there any way to programmatically control how Ctrl+End works? My spreadsheet pulls from a database, and I'd like for Ctrl+End to take them to the last cell to which data has been returned. Thanks in advance. Yours, C.M. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is there a difference between CTRL+D and CTRL+" (quotation marks) | Excel Discussion (Misc queries) | |||
How to make Ctrl-C, ctrl-V work in Office 2007 | Excel Discussion (Misc queries) | |||
Excel 2007: Ctrl+PgUp or Ctrl+PgDn with Protected Sheets | Excel Discussion (Misc queries) | |||
use CTRL key inside a macro IE CTRL + ; | Excel Worksheet Functions | |||
How to forbid ctrl+c and ctrl+X in sheet? | Setting up and Configuration of Excel |