Results 1 to 9 of 9

Automate select, copy, paste command with VBA

Threaded View

  1. #1
    Registered User
    Join Date
    04-12-2021
    Location
    Japan
    MS-Off Ver
    XP
    Posts
    5

    Automate select, copy, paste command with VBA

    Hello Members and Experts,

    Cross-posted at https://www.mrexcel.com/board/thread...-loop.1167869/ (note that an answer has been posted there) --6SJ

    I need to efficiently record a list of 80 bowlers for further analysis and their scores and hope to obtain your help. The table only contains 4 columns:

    column A: Member's Number
    column B: Member's Name
    column C: Rank
    column D: Score

    The most headache is the fact that not all bowlers play exactly same number of game; some play more, some play less, so each member will occupy different number of rows for each score. Eg. the 1st bowler plays 4 games, 2nd bowler plays 6 games, and the 3rd bowler plays 3 games, and so forth. Thus column A and B, starting from row 2 for the first bowler, contain empty rows until the next bowler appears. I then have to copy each bowler's number (column A) and name (column B) and paste to every single row of game score.

    With my very limited knowledge on VBA/Macro I can only create below one that can accomplish the first bowler, but without being able to repeat the process to all others.


    Sub testFill()
    
    ' testFill Macro
    '
        Range("A2:B2").Select
        Selection.Copy
        Range(Selection, Selection.End(xlDown).Offset(-1, 0)).Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        Selection.End(xlDown).Select
     
    End Sub
    I realize some loop process with the likes of Do...Until, Do...While, For....Next but just don't know the appropriate syntax.

    Thanks very much in advance.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 04-12-2021 at 11:51 AM. Reason: Moderator added code tags and cross-post link

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Using VBA to automate copy/paste on new Sheet
    By mdolinger in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-12-2016, 09:18 AM
  2. How to automate copy paste
    By alyasch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2013, 09:36 AM
  3. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  4. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  5. How do I select copy and paste using IF command?
    By Sanghvi in forum Excel General
    Replies: 1
    Last Post: 02-21-2009, 08:07 AM
  6. Automate copy command
    By cwilliams in forum Excel General
    Replies: 0
    Last Post: 04-05-2005, 02:06 PM
  7. [SOLVED] Automate copy command?
    By cwilliams in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-05-2005, 02:06 PM

Tags for this Thread

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