Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default MOVING WITH A RANGE-TAB

What would be the appropriate piece of code for using the feature of TAB,
within a selected range.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving range? wx4usa Excel Discussion (Misc queries) 7 December 26th 09 04:28 PM
sum with moving range snax500 Excel Discussion (Misc queries) 3 July 10th 06 05:56 AM
Moving to next row below a selected range Loris Excel Programming 6 December 5th 05 03:47 AM
formula with moving range sctroy Excel Discussion (Misc queries) 2 November 11th 05 03:20 AM
VB: moving data range Greg Excel Programming 0 September 20th 05 02:39 PM


All times are GMT +1. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"