+ Reply to Thread
Results 1 to 3 of 3

Macro that copies data from one sheet and pastes it to another x columns to the right

  1. #1
    Registered User
    Join Date
    09-26-2013
    Location
    Southampton
    MS-Off Ver
    Excel 2003
    Posts
    3

    Macro that copies data from one sheet and pastes it to another x columns to the right

    Ideally, what I need is a macro that copies the data from cells A2:A4, B2:B4, C2:C4 and paste it into a different sheet a specified number of columns to the right, dependent upon the vale that is in the corresponding cell A1, B1 or C1. So for example, if the data were:

    A1 = 11, B1 = 7, C1 = 9
    A2 = 50, B2 = 200, C2 = 500
    A3 = 150, B3 = 400, C3= 100

    Then the macro would paste the values in cells A2:A3 in cells L2:L3 in a different sheet (11 columns to the right of column A). Similarly it would paste the value in cells B2:B3 into cells I2:I3 (7 columns to the right of column b) and would paste the values of cells C2:C3 into cells L2:L3 (9 columns to the right of column c). Since the values of the cells in A2:A3 and C2:C3 are both pasted into cells L2:L3 it would add the values together so L2 = (50 +500) = 550, L3 = (150 + 100) = 250.

    Does this make sense? Is this possible? Is this the offset function?

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro that copies data from one sheet and pastes it to another x columns to the right

    can you attach a sample file with data and desired result ?
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro that copies data from one sheet and pastes it to another x columns to the right

    Hi, Stevebarnes,

    a really good description of what you have and what you want - and I really mean that.

    Maybe give this code a try:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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. Replies: 1
    Last Post: 07-28-2013, 01:35 PM
  2. Write a macro that filters, copies and pastes data according to a drop-down list
    By ClaraW89 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2012, 08:43 AM
  3. [SOLVED] Automating a macro that copies and pastes data and pastes 2 rows under the previous one.
    By thebank in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2012, 05:02 PM
  4. I have a script in where it copies a sheet's data, and pastes it, but over pastes...
    By Cyberpawz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2012, 02:20 AM
  5. Replies: 0
    Last Post: 07-27-2011, 09:48 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