+ Reply to Thread
Results 1 to 6 of 6

Improving existing macro to flip data

  1. #1
    Registered User
    Join Date
    04-20-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    96

    Improving existing macro to flip data

    Hi all,

    I currently have a working macro which I'd like to improve. Its only purpose is to flip the data for as many rows and columns the sheet has, leaving headers alone.

    I mostly need to set the range in a better way (I know its current code can definitely be improved!).

    Is there a better/easier code way to achieve the flip? (Please note I do NOT need the data to be sorted "A-Z", "Z-A" or any other sort Excel might have. I just need the data to be flipped).

    Thanks for any help!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,616

    Re: Improving existing macro to flip data

    With Range("A1")
    .Value = 0
    .AutoFill .Resize(10, 1), xlFillSeries
    End With

    Try:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,616

    Re: Improving existing macro to flip data

    PS. You use Sort object now. sorting can be also done as range method with shorter code so instead of whole:
    Please Login or Register  to view this content.
    you can write just one line:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-20-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: Improving existing macro to flip data

    Hey Kaper!,

    Will try the code tomorrow (Thursday for me) and will let you know if it worked. Thank you so much!

  5. #5
    Registered User
    Join Date
    04-20-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: Improving existing macro to flip data

    Hi again Kaper,

    Your code worked like a charm! Thank you so much! Marking this thread as solved.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,616

    Re: Improving existing macro to flip data

    Hi,

    Glad to hear that, and thanks for marking thread as Solved.

    It would be lovely if you colud also "add me some reputation" by clicking a small star icon in lowerleft corner of my post(s). (and confirming that "you agree").

+ 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] Transposing Data Macro (flip columns)
    By nikeskopje in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-22-2015, 02:12 PM
  2. Improving my existing macro to filter based on more than one criteria
    By MikeRoot in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2014, 10:59 AM
  3. Improving existing macros
    By davidm_uk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-20-2014, 01:44 PM
  4. [SOLVED] Improving existing VBA code and removal of unwanted row
    By Narasimharao Nandula in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-03-2013, 09:56 AM
  5. [SOLVED] Need to Transpose and Flip Table of Data - Macro Probably Needed
    By BobTomlinson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-08-2013, 09:25 AM
  6. Replies: 0
    Last Post: 05-25-2011, 09:28 AM
  7. employee planner, improving existing model
    By hole_alex in forum Excel General
    Replies: 1
    Last Post: 04-01-2007, 02:51 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