+ Reply to Thread
Results 1 to 4 of 4

Adding additional value to a cell without deleting the old value

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    Santa Ana, CA USA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Adding additional value to a cell without deleting the old value

    Hello, all. I have a worksheet that I would like to allow people to add an additional value to a cell in a certain column without losing the old value. Ideally the new value would be separated from the old value with a comma. I know you can manually do this by just adding additional text in the edit window but I'd prefer to not rely on that. If there's a chance to make a mistake it'll likely happen more than I like.

    So, if a cell already has, say, "Colorado" in it and someone clicked on the cell and typed "Wyoming", the new cell value would be "Colorado, Wyoming". The if someone else came along, clicked on the cell and entered "New York" in the cell, it new value would read "Colorado, Wyoming, New York".

    My original thought was that if I used a Worksheet_Change sub (example below) as a trigger to adding the new value to the old value I have the beginnings of a mechanism.

    Please Login or Register  to view this content.

    Only problem is now I have no idea how to retain the old value and add in the new.

    Any hints? Thanks in advance.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Adding additional value to a cell without deleting the old value

    Please Login or Register  to view this content.
    This is one way.
    Last edited by JLGWhiz; 03-14-2018 at 07:00 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    You can "add" a text, clear the cell but don't use edit mod or all will be duplicate !
    If you want to edit cell, you must first clear cell then you can renter all text …

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
        If 
    Not Application.Intersect([C1:C20], TargetIs Nothing Then
            
    If Target.Count 1 Then
                   V 
    Target.Value
                
    If "" Then
                    With Application
                        
    .EnableEvents False
                        
    .Undo
                         Target
    .Value Target.Value IIf(Target.Value """, """) & V
                        
    .EnableEvents True
                    End With
                End 
    If
            
    End If
        
    End If
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Adding additional value to a cell without deleting the old value


    Thanks for the rep' and your private message !

+ 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. Adjusting entire column of formulas by adding additional cell reference
    By lukelucky in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-19-2016, 10:19 AM
  2. [SOLVED] time line adding a specific time frame in each additional cell
    By RobertM01 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-23-2014, 10:22 AM
  3. [SOLVED] Adding an additional amount to a cell based on value
    By Geogirl in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-18-2013, 09:06 AM
  4. Replies: 4
    Last Post: 04-22-2012, 07:55 AM
  5. Excel 2007 : Deleting Duplicates WHILE maintaining additional columns
    By bioinformatics_guy in forum Excel General
    Replies: 0
    Last Post: 03-02-2011, 12:56 PM
  6. Adding additional lines in a cell
    By Mmli in forum Excel General
    Replies: 2
    Last Post: 05-26-2008, 04:44 PM
  7. Deleting additional rows
    By Venkoba in forum Excel General
    Replies: 2
    Last Post: 10-05-2006, 03:34 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