+ Reply to Thread
Results 1 to 5 of 5

Macro to copy three cells to varying number of rows

  1. #1
    Registered User
    Join Date
    05-25-2014
    Posts
    6

    Macro to copy three cells to varying number of rows

    I want a macro to copy three cells into a varying number of rows. The number of rows changes each month. see the attached sample. I want to copy cells I2, J2 and K2 to columns B, C, & D the number of rows shown in cell N4.

    This is the opposite of the macro I was working on last night.

    Thanks

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Macro to copy three cells to varying number of rows

    try this:

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-25-2014
    Posts
    6

    Re: Macro to copy three cells to varying number of rows

    Thank you alansidman. The macro works. I had to change the PasteValues to PasteAll as I want the formulas in the cells. I have several macros but never have used DIM so I cannot follow your logic. But that is ok as it works for what I need.

    How do I post that this thread is solved? Also I could not find the * to click.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Macro to copy three cells to varying number of rows

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks. The Star is at the bottom of the thread and says Add Reputation.

    When you use Option Explicit, you have to define your variables through Dimension (Dim) statements. Doing this helps when you need to debug your code.

  5. #5
    Registered User
    Join Date
    05-25-2014
    Posts
    6

    Re: Macro to copy three cells to varying number of rows

    Again thanks. I found the thread tools and marked this thread solved. I also found the star. I was looking too far down.

+ 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] Macro to copy varying number of cells
    By socalobie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-20-2014, 03:58 AM
  2. Create a Macro to perform a custom sort on varying number of rows
    By Shirley Munro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2013, 07:09 PM
  3. Replies: 3
    Last Post: 03-27-2013, 03:58 PM
  4. macro to sort varying number of rows
    By kmfocht in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-26-2009, 05:34 PM
  5. Using a Macro to perform a VLookup on varying number of rows
    By Shirley Munro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-05-2005, 09:28 AM

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