+ Reply to Thread
Results 1 to 7 of 7

Macro to paste value transpose range adjacent to lookup result

  1. #1
    Registered User
    Join Date
    07-28-2014
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    4

    Macro to paste value transpose range adjacent to lookup result

    I only dabble in macros but am trying a slightly more sophisticated task where in one sheet I key in 12 mths numbers in 12 rows that relate to one row in another data sheet. I want to lookup and find that one specific row and then paste value transpose the 12 mths across 12 columns to the right.

    I've scoured lots of vaguely similar threads in Google but not quite finding my solution - and completely bamboozled with logic/syntax to adapt.

    Appreciate any help.

    Cheers

    Simon

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

    Re: Macro to paste value transpose range adjacent to lookup result

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    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
    07-28-2014
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Macro to paste value transpose range adjacent to lookup result

    I'm not sure if I'm replying to the right person as I got logged out and now can't see the thread!
    However, here's my sample file.
    Thanks very much.
    Simon
    Attached Files Attached Files

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

    Re: Macro to paste value transpose range adjacent to lookup result

    Try this:

    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

  5. #5
    Registered User
    Join Date
    07-28-2014
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Macro to paste value transpose range adjacent to lookup result

    Wow! That worked a treat with the test file thanks. Yet in the syntax I don't see reference to 'transpose' yet it did it!!!!
    My observation from reading numerous threads is that no matter how much I try and interpret solutions posted, I don't understand and perhaps never will. I'll just take the solution and run but would be good if I really understood the logic. I might need to do a VB course! :-)
    I'll run it through the actual model I want it to run on and hope it all works once change relevant sheet names.
    Thanks so much.
    Simon

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

    Re: Macro to paste value transpose range adjacent to lookup result

    The transpose is in the paste special functionality of the code. This line of code with the Flag "True", indicates a transposition

    Please Login or Register  to view this content.
    Look at the link in my signature block

    Learn VBA Video Tutorials.

  7. #7
    Registered User
    Join Date
    07-28-2014
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Macro to paste value transpose range adjacent to lookup result

    Thanks again!

+ 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: 01-03-2014, 03:01 AM
  2. Lookup combobox in range and select adjacent cell
    By gsandy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-03-2013, 04:21 PM
  3. Use Macros to copy and paste transpose through a range of data
    By zxchan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-12-2013, 04:17 AM
  4. Transpose & Paste data based on a count of cells from a range
    By sugondog in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-28-2009, 01:37 PM
  5. lookup from one document to another and paste in adjacent cell
    By howardgrigg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2007, 09:43 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