Results 1 to 5 of 5

Help adapting macro for my C&P needs

Threaded View

  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:

    Sub AdPaste()
    '
    ' AdPaste Macro
    '
    ' Keyboard Shortcut: Ctrl+e
    '
        ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
            False, NoHTMLFormatting:=True
        Selection.Copy
        Range("C53").Select
        Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=True
        Range("C54:C56").Select
        Application.CutCopyMode = False
        Selection.ClearContents
        Range("C55").Select
    End Sub
    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.

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. [SOLVED] 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