+ Reply to Thread
Results 1 to 4 of 4

vba to clear and restore data according to selected cells

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    SOUTH AFRICA
    MS-Off Ver
    MS EXCEL 2016
    Posts
    127

    vba to clear and restore data according to selected cells

    Good day

    Can you please assist with a vba code to clear data and another code to restore previously entered data from selected cells

    Please refer to the attached excel file as reference. The cells to be cleared are highlighted in yellow, and incase after clearing i want to go back to fix something to be able to restore that data

    Thanks;
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,947

    Re: vba to clear and restore data according to selected cells

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JohnTopley; 09-19-2024 at 09:18 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    SOUTH AFRICA
    MS-Off Ver
    MS EXCEL 2016
    Posts
    127

    Re: vba to clear and restore data according to selected cells

    Thanks John

    It works on that sheet but I'm trying to copy it over to the new attached sheet but it doesn't work

    I've attached a new sheet with different cell allocations as I have different file I need to be able to use it on these other files by changing the range of cells
    can this be done?
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,947

    Re: vba to clear and restore data according to selected cells

    How do you expect the code provided to address the latest file which is completely different to the earlier file posted? Unless ranges to be cleared are selected, they will be fixed for each "template".

    And where are we store the "previous" data is required in your post?

    Plus we have the issue of copying back to merged cells!

    It might be better to store the information in files (/sheets) which have a version number if you really need to retrieve earlier data.

    Sample code with MERGED cells removed.

    Please Login or Register  to view this content.
    Last edited by JohnTopley; 09-20-2024 at 11:53 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. [SOLVED] How to save (and then restore) the selected cell on a different worksheet
    By Ed_Collins in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-16-2015, 03:31 PM
  2. [SOLVED] how to clear selected unlocked cells
    By naf123 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-14-2013, 11:45 AM
  3. Replies: 2
    Last Post: 08-28-2011, 02:39 AM
  4. Clear Cells When list is Selected
    By wz4np1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2008, 11:03 AM
  5. clear data from selected cells
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2006, 02:15 PM
  6. Automatically clear values from a range of selected cells
    By John Davies in forum Excel General
    Replies: 1
    Last Post: 06-28-2005, 12:05 PM
  7. [SOLVED] How do I clear data in selected cells automatically
    By Jim Train in forum Excel General
    Replies: 1
    Last Post: 05-25-2005, 01:45 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