Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ctrl+End with VBA
How can I use VBA to find out which cell Excel would move to if I pressed
Ctrl+End (i.e. how do I find the last cell in the used range using VBA)? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ctrl+End with VBA
Hi Dave B,
how do I find the last cell in the used range using VBA)? Try: Dim rng As Range Set rng = Cells.SpecialCells(xlCellTypeLastCell) Note that the last cell in the used range may not be populated. --- Regards, Norman "Dave B" wrote in message ... How can I use VBA to find out which cell Excel would move to if I pressed Ctrl+End (i.e. how do I find the last cell in the used range using VBA)? Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ctrl+End with VBA
By pressing CTRL + End key excel takes you to last used range of you active sheet. Through vba, try this... Code ------------------- Sub Select_CTRL_END() Dim myCol As Integer, myRow As Long myCol = ActiveSheet.UsedRange.Columns.count myRow = ActiveSheet.UsedRange.Rows.count ActiveSheet.Cells(myRow, myCol).Select 'optional to select 'Find your last cell MsgBox ActiveSheet.Cells(myRow, myCol).Address(False, False) End Sub ------------------- -- ilyaskaz ----------------------------------------------------------------------- ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396 View this thread: http://www.excelforum.com/showthread.php?threadid=47777 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ctrl+End with VBA
I believe this 1-line code should do what you're looking for.
ActiveCell.SpecialCells(xlLastCell).Select or as an alternative, this 1 line should work also. ActiveCell.SpecialCells(xlCellTypeLastCell).Select |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
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) | |||
Redefining the Ctrl [ and Ctrl ]s short cut with OnKey? | Excel Programming | |||
Disabling Ctrl-PgUp and Ctrl-PgDn | Excel Programming |