Results 1 to 4 of 4

Need help cleanup vb code.. Some errors!

Threaded View

  1. #1
    Registered User
    Join Date
    03-30-2007
    Posts
    2

    Question Need help cleanup vb code.. Some errors!

    Hey All,

    So I made this bit of code. Pretty much the purpose is to timestamp as the phases of a project change. (Column G has a set of drop down boxes to choose from). However, I'm facing issues. Such as if you try to delete multiple rows it gives debug errors, and also inserting rows is blanked out. Not sure what all I can do to clean this code up to stop these errors.

    Any help would be greatly appreciated!

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rngData As Range
        Set rngData = ActiveSheet.Range("G1:G4000")
         
        If Not Application.Intersect(rngData, Target) Is Nothing Then
            Cells(Target.Row, 8).Value = Now
             
            If Target.Value = "1. Phase 1" Then
                Cells(Target.Row, 9).Value = Now
            End If
             
            If Target.Value = "2. Phase 2" Then
                Cells(Target.Row, 10).Value = Now
            End If
            
             If Target.Value = "3. Phase 3" Then
                Cells(Target.Row, 11).Value = Now
            End If
            
            If Target.Value = "4. Phase 4" Then
                Cells(Target.Row, 12).Value = Now
            End If
            
            If Target.Value = "5. Phase 5" Then
                Cells(Target.Row, 13).Value = Now
            End If
            
            If Target.Value = "6. Phase 6" Then
                Cells(Target.Row, 14).Value = Now
            End If
            
             If Target.Value = "7. Phase 7" Then
                Cells(Target.Row, 15).Value = Now
            End If
            
        End If
        Set rngData = Nothing
        Application.EnableEvents = True
        If Target.Column = 5 Then
        Cells(Target.Row, 6).Value = Now
    End If
    End Sub
    Last edited by vexious; 03-09-2012 at 01:41 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