+ Reply to Thread
Results 1 to 11 of 11

How do I restore Cell Background Color in VB Script while using Excel

  1. #1
    Registered User
    Join Date
    09-04-2022
    Location
    USA
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    6

    How do I restore Cell Background Color in VB Script while using Excel

    I am supporting with some seniors on voluntary basis for a non profit organization.
    Some of them have difficulty to identify the active cell . So I followed the instruction as per YouTube
    Please Login or Register  to view this content.
    The important script I am using is

    Please Login or Register  to view this content.
    This works perfectly fine for highlighting the active cell. Basically it will highlight active row, active column and active cell background in different color.
    Unfortunately while moving from one cell to another cell, the background color of active row, column and cell is reset to normal.
    How do I restore the background color?

    So basically If my understanding is correct before entering the cell, I need to store the current background of row, column and cell in a variable. while leaving I should restore back.
    I am not sure how do I read? what function I should store? what function I should restore?
    Since I am new to VB Script, request your help.

    Thank you
    Last edited by cathsg; 09-05-2022 at 11:50 AM. Reason: solved

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,824

    Re: How do I restore Cell Background Color in VB Script while using Excel

    I'm not sure I understand what you want to do. Do you not want to re-set the background color of the selected row, column and cell to normal when you move from one cell to another cell? It would be easier to help and test possible solutions if you could attach a copy of your file. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary). See the yellow banner at the top of this page for instructions to attach a file.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    09-04-2022
    Location
    USA
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    6

    Re: How do I restore Cell Background Color in VB Script while using Excel

    Thank you for your help

    I have attached two excel files with random data
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    What we need is Row, Column and Active cell should be highlighted like "Sample With Active Cell Highlight.xlsm" but without resetting the Background of Row, Column and Cell colors.

    Thank you

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,824

    Re: How do I restore Cell Background Color in VB Script while using Excel

    I'm still not sure of what you mean by
    without resetting the Background of Row, Column and Cell colors
    Your macro is located in the code module for ThisWorkbook which means it will run for every sheet in the workbook. If you want it to run only for one sheet, try this macro in the code module for the desired worksheet. See if it does what you want. If not, please explain in more detail what you mean by
    without resetting the Background of Row, Column and Cell colors
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-04-2022
    Location
    USA
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    6

    Re: How do I restore Cell Background Color in VB Script while using Excel

    Thanks Mumps1 for your quick response.

    The Volunteers (Mostly Senior Citizens) will have excel file like "Sample Without Active Cell Highlight.xlsx"
    In this excel file lots of data. Some rows, columns and cells are marked in different colors. (As shown in below example)
    Please check the file
    [
    Please Login or Register  to view this content.
    In the above example,Active cell, Active Row, Active Column is not highlighted clearly, this Senior Citizens who are working on the excel sheet have difficulty to identify which cell currently active.

    IMAGE B: Worksheet which highlight Active Row , Active Column and Active Cell But it resets the earlier marked background colors
    So after Executing Above VB Script, the Active Row, Active Column and Active Cell is clearly highlighted, But the VB Script code removes the earlier background marked active row, column and cell colors.
    So we want to restore the Highlighted colors in first file in addition to show active row, active column and active cell.
    Last edited by cathsg; 09-04-2022 at 11:43 AM.

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,824

    Re: How do I restore Cell Background Color in VB Script while using Excel

    So we want to restore the Highlighted colors in first file in addition to show active row, active column and active cell.
    So you want to keep the previously highlighted active row, active column and active cell when you click on a new cell. If this is correct, the macro I suggested in Post #4 should work for you.

  7. #7
    Registered User
    Join Date
    09-04-2022
    Location
    USA
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    6

    Re: How do I restore Cell Background Color in VB Script while using Excel

    Thanks. I have Tried. It works partially.

    See below two images
    TOP IMAGE

    1) SAMPLE BEFORE APPLYING YOUR SUGGESTION

    BOTTOM IMAGE

    2) AFTER APPLYING YOUR MACRO (SUGGESTION)
    Attached Images Attached Images

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,824

    Re: How do I restore Cell Background Color in VB Script while using Excel

    I tested the macro on the file you posted. Please look at the attached file and note cells C4, I18 and N12. These are the cells I clicked. You will notice that the intersecting row and column of each of the cells is highlighted in light blue and the C4, I18 and N12 are highlighted in light purple. My understanding is that is what you wanted. If not, please use the file "Sample Without Active Cell Highlight.xlsx‎" that you previously posted and manually highlight the cells and intersecting rows and columns for the same 3 cells I used so I can see what your end result should look like and post the file.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-04-2022
    Location
    USA
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    6

    Re: How do I restore Cell Background Color in VB Script while using Excel

    Thanks for your help. Same problem persists.

    To understand better, I have recorded the details and uploaded in youtube. So you may able to see the issue clearly.

    Please refer to the attached pdf file which contains youtube link



    Original File (Seniors have difficulty to identify the active cell)

    [https:]//youtu.be/mUAU7kOjDvM

    With youTube guide script applied, the active cell is clearly visible but the script resets the original highlighted cell color.

    [https:]//youtu.be/qvM8pGaGx54

    With ExcelForum member guide, This script does not reset the original color while loading, but when we move from one cell to another cell, the original color is not restored.
    [https:]//youtu.be/w-9KLzpwoUk
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,553

    Re: How do I restore Cell Background Color in VB Script while using Excel

    If you don't want to change the cell that is colored manually then

    1) To a sheet code module in question
    Please Login or Register  to view this content.
    2) To a standard code module
    Select the sheet in question and just run once.
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    09-04-2022
    Location
    USA
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    6

    Re: How do I restore Cell Background Color in VB Script while using Excel

    Quote Originally Posted by jindon View Post
    If you don't want to change the cell that is colored manually then

    1) To a sheet code module in question
    Please Login or Register  to view this content.
    2) To a standard code module
    Select the sheet in question and just run once.
    Please Login or Register  to view this content.
    Thanks your solution worked. Appreciate

+ 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. Excel - background cell color
    By karyx in forum Excel General
    Replies: 5
    Last Post: 10-20-2017, 02:24 AM
  2. Using excel macro to create script to restore cryptolocker
    By norman1nz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2016, 11:00 PM
  3. Replies: 8
    Last Post: 04-02-2016, 04:00 AM
  4. Change cell background color based on another cells background color
    By Queo in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 06-10-2014, 05:28 AM
  5. Replies: 6
    Last Post: 11-07-2012, 10:46 AM
  6. Restore cell grid background
    By km4hr in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 08-16-2006, 04:57 PM
  7. [SOLVED] how do I restore background grid in Excel?
    By roopuppy in forum Excel General
    Replies: 2
    Last Post: 11-11-2005, 06:45 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