+ Reply to Thread
Results 1 to 3 of 3

Range.Copy Macro

  1. #1
    Registered User
    Join Date
    05-22-2019
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    66

    Range.Copy Macro

    Hello,

    I need a Macro that can copy a variable range from the attached Excel sheet into a new Excel sheet. The row number of the range is variable each time, but the columns are the same.
    For example, one time I need to copy the information from row 4, another time from row 20, another from row 45. However, in all three cases, the columns will remain the same.
    The range of columns is always the same: D, E, F, G, H, I, K, L, M, N, O, P, Q

    In the target sheet, each column will pull the information from one of the sheets in the original in the proper order (January, February..etc). So the target sheet will always have 12 rows, and each row will have the information from the columns above.

    I hope this is easy to understand.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Range.Copy Macro

    Sorry, not clear.
    For one thing, I don't know what the "target" sheet is. Unfortunately, the workbook is protected, so I can't insert a sheet. (When you said sheet, did you mean that, or did you want another workbook?)

    I would probably use the INDIRECT() function rather than a macro. All you would need is a column with the month names (identical to the tabs on your sample workbook), and a cell where you enter the Row Number you want to examine (presumably a Vendor, and they are in the same row on every sheet).

    =INDIRECT("'"&$A4&"'!"&SUBSTITUTE(ADDRESS($B$4,COLUMN(),4),"1",""))

    Will achieve this. Column A is assumed to have the Month Name, and $B$4 the row number.
    This formula should be able to be entered once, and copied across and down. (The SUBSTITUTE() formula enables this by picking up the column name as you copy across).

    Hope this is of some help.

    Trust you and yours are well.

    Regards,

    David

  3. #3
    Registered User
    Join Date
    05-22-2019
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    66

    Re: Range.Copy Macro

    Thank you, David. I will look into this.

+ 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. Macro to copy a range of cells to the last available row in another range
    By jucavicc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2019, 12:04 AM
  2. [SOLVED] Macro to copy cells from a selected range and just paste values back to that same range
    By catscats11 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-18-2019, 02:59 PM
  3. [SOLVED] macro error Copy Time format to other Worksheet and continues copy range
    By feroguz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-25-2012, 01:30 PM
  4. Change range of cells within VBA macro and copy and paste to fixed cell range
    By Mannyny in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-20-2012, 11:51 AM
  5. Help with Macro (VBA) copy range if..
    By Umair Ikram in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-03-2009, 08:22 AM
  6. Copy a range using macro
    By Jen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2006, 12:30 PM
  7. Macro to copy a specified range to a variable range
    By SWT in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2005, 04:05 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