+ Reply to Thread
Results 1 to 4 of 4

Two VBA changes not allowed??

  1. #1
    Registered User
    Join Date
    02-17-2010
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    45

    Two VBA changes not allowed??

    Hello,

    From the research I've done the VBA code won't allow these two CHANGES to happen and need to be combined. I keep getting "Ambiguous name detected: Worksheet_Change". I am a VBA noob and need assistance. Need the two codes below combined. Thank you all.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("A5:A3000")) Is Nothing Then
    With Target(1, 3)
    .Value = Date
    .EntireColumn.AutoFit
    End With
    End If
    End Sub

    AND


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Target.Column = 7 Then Exit Sub
    Application.ScreenUpdating = False
    Select Case Target.Value
    Case "Hold"
    Application.EnableEvents = False
    Cells(Target.Row, 8).Value = Now
    Cells(Target.Row, 8).NumberFormat = "MM/DD/YY"
    Cells(Target.Row, 9).Value = ""
    Application.EnableEvents = True
    Case "Off Hold"
    Application.EnableEvents = False
    Cells(Target.Row, 9).Value = Now
    Cells(Target.Row, 9).NumberFormat = "MM/DD/YY"
    Cells(Target.Row, 8).Value = ""
    Application.EnableEvents = True
    End Select
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Two VBA changes not allowed??

    Please Login or Register  to view this content.
    Please use CODE tags.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-17-2010
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Two VBA changes not allowed??

    Perfect!!!! Thank you for your help! You are a Guru.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Two VBA changes not allowed??

    [email protected],

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

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