+ Reply to Thread
Results 1 to 2 of 2

VBA to automatically calculate when cell color changes tied in with other VBA's

  1. #1
    Registered User
    Join Date
    12-15-2011
    Location
    Berkshire
    MS-Off Ver
    Excel 2010
    Posts
    15

    VBA to automatically calculate when cell color changes tied in with other VBA's

    I have a spreadsheet with a couple of VBA's and one module but the last thing I am trying to do is not working I picked up the VBA and module via you tube video and majority of it works fine

    attached file :
    column B is generated when column C has input
    when something has been actioned it will be manually shaded yellow in E9 to G16 and the total of each column will show on row 5 and those still to action not shaded total shows in row 6, but it will only update the totals if you re-edit the formula !

    So then I tried to follow the automatically update totals should a not shaded cell then be shaded yellow from a tutorial on the youtube video "https://www.youtube.com/watch?v=OrAvtXI8zVw" this part is 8:11 in the video and I added the following VBA to the existing VBA's on the "Sheet1 (Sheet1)" under the existing end sub text - but I get an error message "Compile error : ambiguous name detected: Worksheet_SelectionChange"

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("e:g")) Is Nothing Then
    ActiveSheet.Calculate
    End If
    End Sub

    what am I missing / doing wrong

    Am using Microsoft Office Professional Plus 2019
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,869

    Re: VBA to automatically calculate when cell color changes tied in with other VBA's

    You already have sub Worksheet_SelectionChange declared for that sheet. You cannot add another sub with the same name.

    Perhaps modify your existing sub to incorporate the additional functionality:
    Please Login or Register  to view this content.
    Administrative Note:

    Welcome to the forum.

    We recommend that you include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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] Cell Count If Background Color is a Certain Color - Automatically
    By woutie in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-10-2018, 08:20 AM
  2. [SOLVED] Automatically color bars in chart based on color in cell
    By D-smoke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2018, 04:10 AM
  3. Worksheet Calculate Event tied to linked information that needs to be updated
    By siray13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 07:28 PM
  4. Replies: 3
    Last Post: 07-08-2010, 06:48 PM
  5. Automatically calculate and color rows/columns
    By ShaneVadnais in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-05-2008, 04:29 PM
  6. Fomula to Calculate Multiple Columns with TIED Values
    By lumo1985 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-02-2008, 01:23 AM
  7. [SOLVED] Color a cell and a value is automatically assigned to that color.
    By Bossi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-03-2005, 01:06 AM

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