LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default moving the cell selection in VB

I need to know which commands to use in VB to move the cursor as if pressing
the arrow keys in Excel.

I have a data set which contains sales information in 5 columns. They are
salesperson, days to deliver, qty sold, amnt of sale and commission. I want
to add a subtotal which sums the qty, amnt and commission but averages the
days. In Excel if I do a sub-total for the sum (replace) then a sub-total
for hte average (do not replace) then two separate rows are inserted, one
for each function. If I do one sub-total and sum all four metrics, then go
back and change the function ref from 9 to 1 for the average evrything is as
desired.

The VB module looks like this:

This section performs the sub-total to sum all four metrics.

' select cell in upper left corner of sub-total data
Range("A5").Select
' = ctrl/shift-right arrow
Range(Selection, Selection.End(xlToRight)).Select
' = ctrl/shift-down arrow
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
' for every change in salesperson sum metrics
Selection.Subtotal GroupBy:=1, Function:=xlSum, _
TotalList:=Array(2, 3, 4, 5), _
Replace:=True, _
PageBreaks:=False, _
SummaryBelowData:=True


Then I want to navigate to the days sub-total and change it:


Select the column just to the left of the one I want to modify because the
cursor will stop at the balnk cell in the sub-total row.
Range("A5").Select -

' = ctrl-down arrow
Selection.End(xlDown).Select

Here is where I need to arrow down 1 then right 1 to be on the cell I
want to modify.
I tried SendKeys ("{DOWN}") but this does not work

When I get to the cell I will modify with
ActiveCell.FormulaR1C1 = "=SUBTOTAL(1,R[-27]C:R[-1]C)"



 
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 a selection... [email protected] Excel Discussion (Misc queries) 3 July 20th 06 04:50 PM
Moving the Cell Selection Within AutoFilter ajvasel Excel Programming 2 July 13th 06 04:03 PM
using a selection box and moving the accepted data madsenfence Excel Worksheet Functions 1 January 19th 06 03:42 AM
Moving a Selection of Data??? Lime Excel Programming 5 December 18th 05 12:59 AM
Moving a Selection of data??? Lime Excel Worksheet Functions 3 December 17th 05 06:55 PM


All times are GMT +1. The time now is 12:02 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"