+ Reply to Thread
Results 1 to 5 of 5

Help adapting macro for my C&P needs

  1. #1
    Registered User
    Join Date
    12-08-2020
    Location
    Houston, TX
    MS-Off Ver
    365
    Posts
    3

    Help adapting macro for my C&P needs

    New to the forum, and new to using macros in excel. I have a pretty basic C&P need, but am not sure how to set the range so that it's "dynamic," as opposed to it being stuck at the specific cells used when I recorded the macro. Basically, imagine three columns in an excel sheet. From outside excel I need to copy three rows of data, but want to transpose those three rows into three columns of a single row in excel. I recorded the following macro:

    Please Login or Register  to view this content.
    This worked great for the first row used when recording the macro, but when I tried it for the subsequent entry in the following row, obviously it pasted the new data in the previous row. So, what do I need to do to adjust the macro so that the function takes place relative to the cell I have selected. Basically, I have 100 rows of data to paste in per excel file, and I need to go row by row transposing three rows of data into three columns in a single row, row after row.

    Thanks for the help, I really appreciate it.
    Last edited by alansidman; 12-08-2020 at 06:01 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,945

    Re: Help adapting macro for my C&P needs

    @capek
    using code tags instead of quote tags make it easier to read the code. I have changed them for you.
    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
    12-08-2020
    Location
    Houston, TX
    MS-Off Ver
    365
    Posts
    3

    Re: Help adapting macro for my C&P needs

    Quote Originally Posted by alansidman View Post
    using code tags instead of quote tags make it easier to read the code. I have changed them for you.
    Ah! That does make sense. Thanks for fixing it, I'll be mindful of this in the future.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,156

    Re: Help adapting macro for my C&P needs

    Quote Originally Posted by capek View Post
    ... for the subsequent entry
    ... the function takes place relative to the cell I have selected
    ... I have 100 rows of data
    ... row by row transposing three rows of data into three columns in a single row, row after row

    Try
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-08-2020
    Location
    Houston, TX
    MS-Off Ver
    365
    Posts
    3

    Re: Help adapting macro for my C&P needs

    Thanks for the response! And sorry there was lack of clarity in my OP, I was worried that might be the case. I tried out your suggestion, and while it captures the basic idea, it seems to clear all content from the sheet, and each subsequent paste clears out what was previously pasted. Let me attach an example doc which will hopefully clarify what I have in mind.

    If you look at that file, what I'm needing to do is copy three rows of data from outside excel, paste and match destination formatting into the correct worksheet, and then transpose the three pasted rows into the three empty columns in Row2, and then delete the originally pasted rows. Then I need to copy three new rows of data from outside excel, and perform the same process so that they end up in the three empty columns of Row3. And so on and so forth.

    What I am currently doing is copying the three rows of data from outside excel and using the customized ribbon buttons in the attached workbook to more manually achieve the desired result. I select C3 to begin the process of getting the desired data into Row2, then select C4 to being the process of getting the next set of desired data into Row3, etc etc. If I could do this all in one click though via the correct macro, it would save me so much time!

    Does this better clarify what I have in mind? Thanks again for the help!
    Attached Files Attached Files

+ 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] Dynamic macro name / Concatenating macro name / Call a string variable as a macro name
    By vwhite in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-18-2020, 03:36 AM
  2. Support on an adapted range please.
    By KiltedLoon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-30-2019, 07:39 AM
  3. [SOLVED] Can the Array Formula be adapted for columns?
    By asitiz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-23-2018, 06:36 AM
  4. it worked adapted formula now doesn't please help
    By worthingto in forum Excel General
    Replies: 3
    Last Post: 09-18-2011, 02:07 AM
  5. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 AM
  6. Name sheets from adapted cell values
    By claytorm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2007, 11:20 AM
  7. Color Row Macro Problem, adapted from Patrick Malloy macro
    By SteveC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-21-2006, 07:30 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