![]() |
MOVING WITH A RANGE-TAB
What would be the appropriate piece of code for using the feature of TAB,
within a selected range. |
MOVING WITH A RANGE-TAB
<<What would be the appropriate piece of code for using the feature of TAB,
within a selected range. Why not just use the Tab key? If you are developing some kind of demo where the user watches the display demonstrate various concepts, then you might use the following: Application.SendKeys "{TAB}" To select another cell adjacent to the currently active cell without changing the current selection, you could use code similar to the following: ActiveCell.Offset(0, 1).Activate 'Move right one cell. ActiveCell.Offset(1, 0).Activate 'Move down one cell. -- Regards, Bill Renaud |
MOVING WITH A RANGE-TAB
Sorry Bill,
But after selecting a lenghty range, usually with mouse, I shift to the LAST cell with SHIFT+TAB, or even CTRL+"." twice. Whereas your code only moves step by step. Would you kindly recommend me a piece of code for moving to the last cell selected in the range? "Bill Renaud" wrote: <<What would be the appropriate piece of code for using the feature of TAB, within a selected range. Why not just use the Tab key? If you are developing some kind of demo where the user watches the display demonstrate various concepts, then you might use the following: Application.SendKeys "{TAB}" To select another cell adjacent to the currently active cell without changing the current selection, you could use code similar to the following: ActiveCell.Offset(0, 1).Activate 'Move right one cell. ActiveCell.Offset(1, 0).Activate 'Move down one cell. -- Regards, Bill Renaud |
MOVING WITH A RANGE-TAB
<<...your code only moves step by step.
That's what TAB does. <<Would you kindly recommend me a piece of code for moving to the last cell selected in the range? To move to the last cell in a selection, regardless of whether it has data in it or not, try the following: '---------------------------------------------------------------------- Public Sub ActivateLastCellInSelection() Dim rngSelection As Range Dim rngLastCell As Range On Error GoTo ExitSub Set rngSelection = Selection With rngSelection Set rngLastCell = .Resize(1, 1) _ .Offset(.Rows.Count - 1, _ .Columns.Count - 1) rngLastCell.Activate End With ExitSub: End Sub -- Regards, Bill Renaud |
All times are GMT +1. The time now is 06:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com