Results 1 to 6 of 6

VBA stopped working!!

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-30-2008
    Location
    Los Angeles
    Posts
    144

    VBA stopped working!!

    Yesterday I received great help from everyone on the code below. It worked perfectly allowing me to select more than one item in a drop down.

    Today it stopped working. I had copied the file with a new name and changed the target column to 14 (Column N) and it did not work.

    I went back to the original file with column 10 and it does not work either. Any ideas would be appreciated.....thanks again Max
    -----------------------------------------------------
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim sOld    As String
        Dim sNew    As String
        Dim rVal    As Range
    
        If Target.Column <> 14 Then Exit Sub
    
    
        On Error Resume Next
        Set rVal = Me.Cells.SpecialCells(xlCellTypeAllValidation)
        If rVal Is Nothing Then Exit Sub
        On Error GoTo 0
    
        If Not Intersect(Target, rVal) Is Nothing Then
            Application.EnableEvents = False
            sNew = Target.Value
            Application.Undo
            sOld = Target.Value
    
            If Len(sNew) = 0 Then
                Target.ClearContents
            ElseIf Len(sOld) = 0 Then
                Target.Value = sNew
            Else
                Target.Value = sOld & ", " & sNew
            End If
    
            Application.EnableEvents = True
        End If
    End Sub
    Last edited by maxthebear; 02-18-2009 at 09:51 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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