Hi folks.
Do you know a hotkey which lets me mark all cells from the current one to the last/first of column ?
In the helpfile there are all sorts of hotkeys for almost any scenario, but it seems to me as if this specific action lacks a hotkey
Thanks a lot!
Down arrow while holding Ctrl-Shift?
Regards
Special-K
I rarely return to a problem once I've answered it so make sure you clearly define what the trouble is.
If by "mark" you mean highlight as in selecting cells, then . . .Do you know a hotkey which lets me mark all cells from the current one to the last/first of column ?
Well, Let's say you are in cell A1 and your data extend down to cell A1000
Make A1 the activecell, the press Ctrl + Shift + down arrow to select the entire range of rows in column-A. (Will have press more than once if there are blank rows in between.)
If you want to move across the columns, then
Ctrl + Shift + right arrow
To select the entire current region
Ctrl + A
So if data are in A1:Z1000, Ctrl + A will select that range.
If this is not what you are after, then explain what you mean by "mark all cells"
Last edited by Palmetto; 08-31-2009 at 04:49 PM.
Thanks.
I know this hotkey, but from what I can gather from the helpfile and my personal tests, this would be doing what I want, except that it *STOPS* at blank cells. So if somewhere in the column, you have blank cells, the selection would not go all the way down (or up), but only so far as a blank cell is found ....
Yes, sorry if that was uncleas, I meant "selecting" indeed.
Thanks for all your suggestions!
Well, that's exactly my problem. I was looking for a keyboard shortcut to select:(Will have press more than once if there are blank rows in between.)...., not to the last/first non-blank cell in the column.Originally Posted by boarders paradise
I would need this function for almost all my sheets, and I almost can't imagine that something that basic is not covere by a shortcut (considering some of the very exotic shortcuts there are otherwise ....)
You'll have to use VBA, something alongs the lines of
Which will select a range of cells begining with the activecell to the last row/column.Code:Sub Select_Cells() Dim lrow As Long, lcol As Long, rCell As Range lrow = Cells(Rows.Count, 1).End(xlUp).Row lcol = Cells(1, Columns.Count).End(xlToLeft).Column With ActiveSheet Set rCell = ActiveCell Range(rCell, Cells(lrow, lcol)).Select End With End Sub
See attached workbook, to which the short cut Ctrl + g was assigned to the macro.
Well, first of all, let me thank you ... I hope you didn't have to create the .xls especially for me ... or if you really did, than at least I hope you are experienced enough, that it was quick and easy for you ... I hope I didn't cause you too much work ...
I opened the .xls file, but I am not sure if I understand your idea. Because when I click on the button, or when I press CTRL+G, all cells are selected to the lower/right end of the sheet. That's the same as Excel's built-in shortcut CTRL+SHIFT+END, isn't it ?
I would need to stay in the same column ...
You weren't specific about your requirements, which is why I said "along the lines of . ."I would need to stay in the same column ...
Use this revised code, which will select all the cells in the column from activecell to the last used row in the column.
Code:Sub Select_Cells() Dim lrow As Long, lcol As Long, rcell As Range lrow = Cells(Rows.Count, 1).End(xlUp).Row lcol = ActiveCell.Column With ActiveSheet Set rcell = ActiveCell Range(rcell, Cells(lrow, lcol)).Select On Error Resume Next End With End Sub
Perfect !! It works great, thank you so much!
How would I have to change the macro for it to select all the way down to the last cell, not to the first (which your code does) ?
When I modify your code like this ...
... I get an error ...Code:lrow = Cells(Rows.Count, -1).End(xlDown).Row
Last edited by boarders paradise; 08-31-2009 at 07:28 PM.
The code as originally given already finds the last used cell in the column.How would I have to change the macro for it to select all the way down to the last cell, not to the first (which your code does) ?
So if cell A1000 is the last used cell in column-A and cell A25 is the active cell when you run the macro, the range selected is A25:A1000.
If A10000 is the last used cell, then it selects A25:A10000.
What do you mean by "down to the last cell"?
When I copy your code exactly as is, the macro selects "up", not "down".
So for example, ...
A1:A25 for me (and not A25:1000 like you wrote).
Which is not bad anyway, because I need 2 macros for both directions "up to first cell" and "down to last cell" (in column). So your macro already does "up to first cell" for me .... hence my efforts to modify your code so that it would select downwards from the active cell to the last cell in the column.
But the modifications I tried (and posted above) resulted in errors (obviously, because I have no clue of VisualBasic ...)
Hm ....
I don't know if you will believe me, but I swear I didn't change anything, but now, your macro "selects down to the last cell", not up to the first cell ...
Well, anyway, I would need both macros, so how would I have to change the 3rd line of your code to get the other direction ?
Palmetto's code works for me as advertised.
Here's another way:
Code:Sub Sel2Top() Here2Top(ActiveCell).Select End Sub Sub Sel2Bot() Here2Bot(ActiveCell).Select End Sub Function Here2Top(cell As Range) As Range Dim rTop As Range Set Here2Top = cell(1) With cell.Parent Set rTop = .Cells(1, cell.Column) If rTop.Value = Empty Then Set rTop = rTop.End(xlDown) If rTop.Row < cell.Row Then Set Here2Top = .Range(cell(1), rTop) End With End Function Function Here2Bot(cell As Range) As Range Dim rBot As Range Set Here2Bot = cell(1) With cell.Parent Set rBot = .Cells(.Rows.Count, cell.Column) If rBot.Value = Empty Then Set rBot = rBot.End(xlUp) If rBot.Row > cell.Row Then Set Here2Bot = .Range(cell(1), rBot) End With End Function
Last edited by shg; 08-31-2009 at 09:22 PM.
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks