+ Reply to Thread
Results 1 to 5 of 5

Macro Button to Swap Entire Rows - please help

  1. #1
    Registered User
    Join Date
    01-05-2020
    Location
    Chicago
    MS-Off Ver
    2019?
    Posts
    2

    Post Macro Button to Swap Entire Rows - please help

    Hi!
    I have a data set that has many rows with the same number of columns in each row (10). The first column in each row has an ID #. I am looking to create a macro/button of some sort where you can type in 2 ID #'s and swap the row locations. I am fairly new to excel so anything helps. Is this possible? OR is there an easier way to do this?
    Thanks so much!
    Ella


    I have attached a photo below for clarification.
    EX: I want to have some sort of user form where i can type in ID #4, ID#2, and as a result rows 3 and 5 would be swapped.
    Attached Images Attached Images

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro Button to Swap Entire Rows - please help

    Please try the attached - it should work with any number of columns.
    Attached Files Attached Files
    Martin

  3. #3
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Macro Button to Swap Entire Rows - please help

    Please Login or Register  to view this content.
    You can put this in code module1 and then attach it to a Form Controls button selected from Developer>Insert>Form Controls.
    Last edited by JLGWhiz; 01-05-2020 at 03:55 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  4. #4
    Registered User
    Join Date
    01-05-2020
    Location
    Chicago
    MS-Off Ver
    2019?
    Posts
    2

    Re: Macro Button to Swap Entire Rows - please help

    THANK YOU SO MUCH.
    I am having trouble connecting my initial command button (swap) to pull up the userform. Are you using the active x or the form contro button/

  5. #5
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro Button to Swap Entire Rows - please help

    I'm using the form button.

+ 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. VBA Macro Button to delete entire row
    By anthonator in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-05-2018, 02:32 PM
  2. Need a Macro to swap Data with a click of a Button
    By JonWilf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2016, 09:27 AM
  3. Macro Button to Delete Entire Row if cells in two columns are empty in certain worksheet
    By Adriana Lee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2015, 07:49 PM
  4. [SOLVED] Macro Button to send Entire Workbook as PDF via email
    By Rosco88 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-21-2013, 10:08 AM
  5. [SOLVED] Swap button text
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-14-2013, 02:25 PM
  6. Toggle Button to swap link results from another worksheet
    By mochatrpl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-30-2013, 10:37 PM
  7. [SOLVED] Excel macro that selects entire table rows, not whole rows
    By jimmykup in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-13-2012, 10:51 AM

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