+ Reply to Thread
Results 1 to 2 of 2

Macro to copy data into a variable number of rows

  1. #1
    Registered User
    Join Date
    02-10-2015
    Location
    England
    MS-Off Ver
    2010
    Posts
    1

    Macro to copy data into a variable number of rows

    I need to copy data from one cell into a number of rows but the number of rows will change each time the report is produced. The macro I have created so far includes the following which I assume is the part that is copying the data into the cells:

    Range("D1").Select
    Selection.AutoFill Destination:=Range("D1:D131")
    Range("D1:D131").Select

    However I do not want the macro to define the D1:D131 bit as next time there may be more or less rows. What can I enter into the macro instead?

    New to all this so any help is most appreciated.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Macro to copy data into a variable number of rows

    Try this
    Please Login or Register  to view this content.
    But the question how to determine the lastrow ?? based on what column?

+ 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. [SOLVED] Use a formula within a macro to extract data and copy down x number of rows
    By rdowney79 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-15-2013, 12:25 PM
  2. [SOLVED] Macro code to insert 3 rows on spreadsheet with variable number of rows
    By D18GE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2013, 07:33 AM
  3. Copy a variable number of rows and columns to last row of another worksheet
    By SSGMiami in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2011, 10:46 AM
  4. Copy a variable number of rows
    By satishkhatri in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-23-2008, 07:52 AM
  5. Copy cells to variable number of rows
    By Acct Supr - DCTC in forum Excel General
    Replies: 3
    Last Post: 11-14-2005, 01:30 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