+ Reply to Thread
Results 1 to 9 of 9

VBA Arrays help required - Copying a cell several times

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    87

    VBA Arrays help required - Copying a cell several times

    hi

    My situation is as follows. I have a list of 1400 eight digit numbers in column A. I need to copy each number 25 times
    and paste the resulting list of 35000 numbers (1400 x 25 ) on a second worksheet.

    I tried doing this by looping through each cell but its just too slow.
    How can this be done using vba arrays please, for speed purposes. im relatively new to VBA and struggling.

    Many thanks.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Arrays help required - Copying a cell several times

    Please attach a sample.

  3. #3
    Registered User
    Join Date
    04-19-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: VBA Arrays help required - Copying a cell several times

    sample.xlsx

    Quote Originally Posted by AB33 View Post
    Please attach a sample.
    Sample now attached. Many thanks

  4. #4
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: VBA Arrays help required - Copying a cell several times

    numbers in column A of active worksheet copied x25 to new sheet called "Output"
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Arrays help required - Copying a cell several times

    Try the attached.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Arrays help required - Copying a cell several times

    This is slightly faster.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-19-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: VBA Arrays help required - Copying a cell several times

    @AB33 - Thanks so much! works like a charm!

    How would i modify this to copy a block of numbers that is 25 rows by 1 column, down a column one after the other?

    cheers

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Arrays help required - Copying a cell several times

    The code does 25 rows by 1 column?

    Do you mean that you have more than 1 columns?

  9. #9
    Registered User
    Join Date
    04-19-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: VBA Arrays help required - Copying a cell several times

    The making of those row copies was the first step of my task. Your code was perfect.
    They they wanted another block of data, consisting of 25 rows by one column (so basically a column of data)
    to be copied next to the rows we generated earlier. That is eg Paste it to cover rows 2 to 26, move down to the first empty
    cell below what you just pasted and repeat the process. All the way down.

    I gave it a go and replaced the code in your for loop with:

    Please Login or Register  to view this content.
    which worked. Do you have a more elegant scalable solution? cheers

+ 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. Copying a cell a certain number of times based on the value of another cell
    By Vallenum in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2013, 11:39 PM
  2. Required difference between two dates/times in hours
    By kasi.maddula in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-26-2013, 07:14 AM
  3. [SOLVED] counting number of times a value does not appear in a multiple named arrays
    By greyscale in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 01-22-2013, 11:39 PM
  4. Problem of cell format when copying times
    By wlan in forum Excel General
    Replies: 1
    Last Post: 09-17-2010, 03:34 AM
  5. Copying specific cell ranges from a worksheet multiple times to a new sheet
    By kaz8772 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-10-2009, 03:54 PM

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