+ Reply to Thread
Results 1 to 4 of 4

Multiple Worksheet Changes in 1 sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    10-13-2011
    Location
    phoenix
    MS-Off Ver
    Excel 2011
    Posts
    5

    Multiple Worksheet Changes in 1 sheet

    Hey All,

    I need help getting these two worksheet changes into one sheet, which means I have to combine them and I can't, for the life of me, figure out how to do this. Any help would be greatly appreciated. It's the same code except for different columns.

    Thanks,
    Brian


    Private Sub Worksheet_Change(ByVal Target As Range)
        With Target
            If .Cells.Count > 1 Then Exit Sub
            If Intersect(.Cells, Me.Range("C:C")) Is Nothing Then Exit Sub
            .Offset(0, -2).Value = Now      '''''' or  Now
            
        End With
    End Sub
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        With Target
            If .Cells.Count > 1 Then Exit Sub
            If Intersect(.Cells, Me.Range("f:f")) Is Nothing Then Exit Sub
            .Offset(0, -4).Value = Now      '''''' or  Now
            
        End With
    End Sub
    Last edited by foxbd; 03-29-2013 at 05:36 PM. Reason: Solved

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple Worksheet Changes in 1 sheet

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Multiple Worksheet Changes in 1 sheet

    hi foxbd, sort of that basing on your codes

    Private Sub Worksheet_Change(ByVal Target As Range)
        
        With Target
            
            If .Cells.Count > 1 Then Exit Sub
                
            Application.EnableEvents = 0
                
            If .Column = 3 Then
                .Offset(0, -2).Value = Now
            ElseIf .Column = 6 Then
                .Offset(0, -4).Value = Now
            End If
            
            Application.EnableEvents = 1
            
        End With
        
    End Sub

  4. #4
    Registered User
    Join Date
    10-13-2011
    Location
    phoenix
    MS-Off Ver
    Excel 2011
    Posts
    5

    Re: Multiple Worksheet Changes in 1 sheet

    That is perfect. Thank you soooo much. I knew there was an easier way to do it and I've been working on it all day. Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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