+ Reply to Thread
Results 1 to 5 of 5

Code for Controlling Cursor Movement

  1. #1
    Registered User
    Join Date
    09-15-2012
    Location
    Sequim, WA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Code for Controlling Cursor Movement

    First, my skills at coding VBA are limited. Having said that, I am the administrator of a fantasy football league and would like to automate the recording of players selected by each Owner during the league’s initial draft at the start of the season. So far I have developed a workbook with two worksheets which I have named “Draft Sheet”(where each Owner’s selection is recorder in cells C2:I13) and “Players” (a list of NFL players). My plan is to activate the cell of the Owner’s selection on the “Players” sheet and have my macro, via command button, select this player and paste it in the appropriate cell of the “Draft Sheet” then advance the cursor to the next selection position. I have written the code for the copy and paste aspect of the macro but have hit a snag instructing the cursor to its next position due to the odd order of the draft on the “Draft Sheet”. The required cursor movement follows. Starting in cell C2 proceed downward to cell C13 then over to cell D13 then proceed upward to cell D2 then over to E2 and then down again. This pattern of down, over, up and over repeats itself for columns F, G, H, and I. This is way beyond my skill level. Need help.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Code for Controlling Cursor Movement

    repeats itself for columns F, G, H, and I.
    Explain ...

  3. #3
    Registered User
    Join Date
    09-15-2012
    Location
    Sequim, WA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Code for Controlling Cursor Movement

    Draft Sheet.jpg

    Starting in cell C2 I would like the cursor to advance to the next cell (C2 to C3 to C4 down to C13 and then C13 to D13 up to D12 so forth an so on) as illustrated in the attached picture each time content is added to the active cell. The numbers in the cells indicate the order of the picks in the draft.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Code for Controlling Cursor Movement

    .
    Paste this into a regular Module. Paste a CommandButton on the sheet connected to the macro. After clicking the command button, use the TAB key to move from one cell to the other.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-15-2012
    Location
    Sequim, WA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Code for Controlling Cursor Movement

    Logit thanks for your quick response. However, I have not explained my needs very well. So I'll take a different approach. Below I have attached my workbook for your review. First, I have added the Offset property to my above macro so the cursor advances down one cell in the same column. I have filled in the first ten draft picks by selecting one at a time and each in turn the players name from the "Players" worksheet and clicking on the "Copy & Paste Player's Name" command button. By selecting a player's name and clicking on the "Copy & Paste Player's Name" button the name is paste into the active cell on the "Draft Sheet" worksheet and the cursor advances down to the next cell and is ready for the next draft pick. All that needs to be done is go back to the "Players" worksheet and place the cursor on the name of the player selected by the next owner and click the command button. This is where I need help. After the 12th pick instead of the cursor moving down I need it to move to the right one column on the same row. Following this pick I need it to move up one cell at a time in the same column to the top cell where I need it to move right to the next column in the same row. After this pick it needs to move down one cell until it has advanced through all 84 cells in the range C2:I13 following the pattern shown in the image in my previous post. So what I need is code to replace the simple Offset script I've written that will advance the cursor as I've just described.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. code/formula needed for assigning cursor movement to specific cells in unprotected sheet
    By HenrikHagdahl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2013, 05:55 PM
  2. [SOLVED] cursor movement
    By akcommerce in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2013, 06:08 AM
  3. Excel 2007 : Cursor Movement after Scanning a Bar Code
    By KERNELJEFF in forum Excel General
    Replies: 4
    Last Post: 12-16-2011, 04:55 PM
  4. controlling cursor movement in unlocked and protected cells
    By thomaskprakash in forum Excel General
    Replies: 1
    Last Post: 09-02-2009, 08:51 AM
  5. Cursor Movement (Code Required)
    By harishs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2007, 05:14 PM
  6. VBA code for cursor movement without leaving scroll area
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2005, 10:59 AM
  7. [SOLVED] Cursor movement
    By Ann Calantzis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-25-2005, 12:06 PM
  8. Controlling the movement of a drawing object
    By Andrew B in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2005, 08:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1