+ Reply to Thread
Results 1 to 2 of 2

Need a Macro to swap Data with a click of a Button

  1. #1
    Registered User
    Join Date
    12-04-2015
    Location
    Lancashire
    MS-Off Ver
    2010
    Posts
    15

    Need a Macro to swap Data with a click of a Button

    Sample Data.xlsm

    (Sample Data Attached, Student names have been changed to X for data protection)

    Hi all, I work in a school and have created this spread sheet for grade analysis.

    I am after (what seems to me a complex VBA) macro that will change a certain Criteria in the cells of the table. I would like the macro to pick out all of *3 grades and change them to the corresponding *1 Grade. Here is a table of what I need converting.
    A*3 To A1
    A3 To B1
    B3 To C1
    C3 To D1
    D3 To E1
    E3 To F1
    F3 To G1

    Then... If a grade is changed the number to the right of the changed grade needs to change by subtracting 2 from it.
    The table has a range of Data but it is only the data ending in 3 that needs to be converted with their numbers, the rest can stay the same.
    There is 3 Red columns in the table, these are targets and need to stay fixed (so the macro doesn't apply to these columns).

    Then along the top I need two buttons - "X2 Secure" which will activate the macro and "X3 Secure" which will reset the Macro. the button needs to stay Highlighted so we know which one is selected.
    FYI-The grade data gets updated after every Data capture and I use this spread sheet for all year groups (multiple versions) So maybe this work book needs to be a template for me to drop the data in??

    It would be amazing if this is possible.

    Thanks
    Last edited by JonWilf; 01-12-2016 at 05:58 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Re: Need a Macro to swap Data with a click of a Button

    I think (if I understand correctly) you are over complicating your requirements.

    use the developer tab to draw two buttons at the top of your sheet.

    1) Record a macro 'ChangeUp' select the ranges required (without the fixed columns) using (selection + add selection) then Click 'Find/Select, 'Replace. 'Find A3 'Replace with A1 ' Replace All, 'OK. Do this for b,c,d,e,f. Stop the Macro. Right click 'Button 1 and assign the 'ChangeUP macro.

    2) Record a Macro 'ChangeDown select the same ranges and use find and replace but in the reverse order then assign button 2 to this macro.

    A quick tester below

    Sample Data.xlsm
    Last edited by BlindAlley; 01-12-2016 at 09:33 AM.

+ 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. Button Click on Spreadsheet commanded by Button Click on Userform
    By Quilie19 in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 04-07-2015, 11:35 PM
  2. stoping duplicate record of data with double click of macro button
    By ajleeds in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-14-2014, 10:43 PM
  3. [SOLVED] Swap button text
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-14-2013, 02:25 PM
  4. [SOLVED] How do I run the macro for a button click without clicking the button?
    By flyboy54 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2012, 10:45 AM
  5. Replies: 0
    Last Post: 11-27-2010, 06:38 AM
  6. Swap cell contents with mouse click.
    By ukmxer in forum Excel General
    Replies: 1
    Last Post: 09-19-2007, 04:12 PM
  7. Excel should let you select 2 rows, right click, and SWAP them
    By DG_Crewdson in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-15-2006, 02:15 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