add to cell after select from form

  • Hello, when cell is clicked a form is opened allowing user to select couple of options. I need to change the code so that: it still opens a form allowing user to select options but also when cell is clicked it let user to add his comment to the existing string (without doublling it)

    Code
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)	Dim rngDV As Range	Dim oldVal As String	Dim newVal As String	Dim strList As String	On Error Resume Next	Application.EnableEvents = False	 	   Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)	   On Error GoTo exitHandler	 	   If rngDV Is Nothing Then GoTo exitHandler	   	   If Not Intersect(Target, rngDV) Is Nothing Then	      If Target.Validation.Type = 3 Then	         	         strList = Target.Validation.Formula1	         strList = Right(strList, Len(strList) - 1)	         strDVList = strList	         frmDVList.Show	      End If	   End If	 	exitHandler:	  Application.EnableEvents = True	  	End Sub	 	Private Sub Worksheet_Change(ByVal Target As Range)	Dim rngDV As Range	Dim oldVal As String	Dim newVal As String	Dim strSep As String	strSep = ", "	  Application.EnableEvents = False	On Error Resume Next	If Target.Count > 1 Then GoTo exitHandler	 	 	Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)	On Error GoTo exitHandler	 	If rngDV Is Nothing Then GoTo exitHandler	 	If Intersect(Target, rngDV) Is Nothing Then	    	    	    'here I'd like to make change	    Range(rngDV).ClearContents	    	    	    	Else	 	  newVal = Target.Value	  Application.Undo	  oldVal = Target.Value	  Target.Value = newVal	   If newVal = "" Then	      	   Else	         If oldVal = "" Then	            Target.Value = newVal	         Else	            Target.Value = oldVal & strSep & newVal	         End If	    End If	 	End If	 	 	exitHandler:	  Application.EnableEvents = True	End Sub

    Could you please help? s.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!