+ Reply to Thread
Results 1 to 9 of 9

Macro to copy same 3 cells repeatedly

  1. #1
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9

    Macro to copy same 3 cells repeatedly

    Hi Folks,

    I am a fairly experienced Excel user who has never delved into Macro's, but recently started a fun project for myself & whilst I am pretty sure they are the solution, I simply cannot make it work the way I want. Here is the scenario...

    I am developing a tool for someone to record live player stats during basketball games that I coach. My aim is to have a form with a range of buttons on it, each button represents a player & an activity, ie a row of buttons for Player 1 that each represent a shot,a rebound, a steal, etc

    My recording solution thus far has been to create a column with players names & another column with each of the stat items that I wish to record. I also want to record time. Below is the code that I have recorded via the standard Excel macro record function

    Please Login or Register  to view this content.
    I can assign this macro to a button & when I hit the button the first time the macro runs just fine, & records the infor exactly where & how I expect, but the second time I run it it takes the values for the cells in the next row & each additional time it moves down a row again, whereas each time I want it to use the same data again & again. What have i not included?

    Alos Icannot get the time to display in seconds - I think it is something in my machine as I have selected the correct format in Excel, but it will only go to minutes. Idealy I would have it display a time simce the sqart of the game & in theory I know how to do that, but I 'll worry about that next...

    thanks in advance

    James
    Last edited by jsnoz; 11-21-2008 at 01:43 AM. Reason: Asked to!

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387
    jsnoz,

    Please post your workbook - see "Manage Attachments".


    Have a great day,
    Stan
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9
    Attached!

    Has changed slightly as I was just playing in a blank workbook - hopefully the sheet names & little info in there will help enough for you to understand what I am trying to achieve.

    Having said that I am now getting a slightly different error to that which I described, being it appearsto just be entering again & again in the one row rather than progressing to the next row in the sheet...

    Thanks again!
    Attached Files Attached Files

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    jsnoz,

    Welcome to the forum.

    Please take a few minutes to read the Forum Rules about thread titles, and then edit yours to make it descriptive of your problem.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9
    Quote Originally Posted by shg View Post
    jsnoz,

    Welcome to the forum.

    Please take a few minutes to read the Forum Rules about thread titles, and then edit yours to make it descriptive of your problem.
    That's easier said than done... I did actually read the rules, but quite honestly I do not know how to describe what I want to achieve in few enough words - short of saying "recording hoops stats" which I felt was less appropriate than the option I chose.

    If I had sufficient knowledge to describe exactly what I needed to do, or what in fact the problem was, maybe I could do it without asking for help

    Thanks for welcome!

    BTW I've had a go, but not convinced it say what I need it to! Cheers
    Last edited by jsnoz; 11-21-2008 at 01:44 AM.

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387
    jsnoz,

    Having a problem with your attached workbook.

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Press and hold down the 'ALT' key, and press the 'F11' key.

    Insert a Module in your VBAProject, Microsoft Excel Objects

    Copy the below code, and paste it into the Module1.

    Please Login or Register  to view this content.

    Select, click on a cell with a players name and number.

    Then run the below macro.


    Or, try this macro assigned to your "Miss" button under "2 pt shot".


    Have a great day,
    Stan

  7. #7
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9
    Thanks for your help Stan, unfortunately I am getting a "Run-Time Error 1004", with the comment Unable to "get the Find property of the WorrksheetFunction class".

    Sounds like I have bitten off way more than I can chew, as the code you sent back is way beyond my limited cababilities of understanding...

    Really appreciate your help & if there is anything else that I can give you that may be able to give you to help you debug let me know as unfortunately as much as I would love to be able to take it on myself, I simply don't have the knowledge without a stack more help...

    Again, thanks for your time.

    James

  8. #8
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to copy same 3 cells repeatedly

    jsnoz,

    See the attached worbook "Stat Sheet Testing - jsnoz - SDG.xlsm".

    Test the four buttons on sheet "Data Entry Form".


    Have a great day,
    Stan
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9
    Stan that is fantastic, thanks!

    Now to see if I can cut & paste & make the rest work, without stuffing everything up!

    Again thank you, I look forward to posting the completed product!

    James

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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