+ Reply to Thread
Results 1 to 3 of 3

Change cells based on value of other cells

Hybrid View

  1. #1
    Registered User
    Join Date
    11-18-2016
    Location
    Southampton
    MS-Off Ver
    2016
    Posts
    1

    Change cells based on value of other cells

    Probably a really simple formula for this. I have two cells, both of which I want to be able to change. When I change them, the changes affect other cells in the file which is fine. These two specific cells must always add up to 100 though, and so when I change one and set it at say, 70 - I want the other one to automatically update to 30 so that I don't continually have to keep changing both cells. I'm sure it's possible ... what's the solution?

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,667

    Re: Change cells based on value of other cells

    You shall use macros for that. In particular, you shall write event handler for worksheet change event. There are several examples on this forum and on the net how to do it
    Best Regards,

    Kaper

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,667

    Re: Change cells based on value of other cells

    If you are not sure how to implement this advice, see attached file (remember to allow macro execution)
    Focus on Sheet1 (Arkusz1) code - right click on Arkusz1 tab and select display code to see it. Change A1 and B1 to your "connected cells" addresses

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Union(Range("A1"), Range("B1"))) Is Nothing Then
      Application.EnableEvents = False
      If Not Intersect(Target, Range("A1")) Is Nothing Then
        Range("B1").Value = 100 - Range("A1").Value
      Else
        Range("A1").Value = 100 - Range("B1").Value
      End If
      Application.EnableEvents = True
    End If
    End Sub
    Attached Files Attached Files
    Last edited by Kaper; 11-18-2016 at 05:16 PM.

+ 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. Change order of static cells based on dynamic formula based cells
    By S_O_A_L in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2016, 04:33 AM
  2. Replies: 1
    Last Post: 12-23-2015, 02:08 PM
  3. [SOLVED] Change a cells Text based on the Values of 3 other cells
    By cityinbetween in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-08-2014, 06:58 PM
  4. [SOLVED] Linking cells globally to allow users the ability to change cells on separate sheet/cells.
    By V1gilante in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2014, 10:47 PM
  5. [SOLVED] Cells change based on adjacent / another cells
    By alexnkc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2013, 08:39 PM
  6. Need help making cells change based on other cells
    By themdamnducks in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-01-2013, 02:24 PM
  7. [SOLVED] Change a cells value based upon another cells value
    By Liam.Poll in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-15-2012, 03:58 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