+ Reply to Thread
Results 1 to 8 of 8

Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another cell

Hybrid View

mhitz Macro that automatically... 05-04-2013, 05:14 PM
TMS Re: Macro that automatically... 05-04-2013, 05:34 PM
mhitz Re: Macro that automatically... 05-04-2013, 07:24 PM
mehmetcik Re: Macro that automatically... 05-07-2013, 05:16 PM
mehmetcik Re: Macro that automatically... 05-04-2013, 05:53 PM
mhitz Re: Macro that automatically... 05-04-2013, 07:22 PM
TMS Re: Macro that automatically... 05-04-2013, 06:09 PM
TMS Re: Macro that automatically... 05-07-2013, 05:54 PM
  1. #1
    Registered User
    Join Date
    05-04-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another cell

    Hello,

    I am having trouble figuring out code to have excel automatically input "RECHECK STATUS" in one cell when the date changes in another cell.

    The dates will be in column D, and "RECHECK STATUS" will be in column E.

    So, for example, if a user changes the date in cell D6, how can I make excel automatically input "RECHECK STATUS" in E6?

    And, for example, if a user changes the date in cell D15, how can I make excel automatically input "RECHECK STATUS" in E15? (Notice I am trying to make this work for the full range of columns D and E).

    Also, I would like the ability to delete "RECHECK STATUS" after status is checked.

    Thank you to anyone who can come up with a solution.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,188

    Re: Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cell As Range
    If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    For Each cell In Intersect(Target, Range("D:D"))
        cell.Offset(0, 1).Value = "RECHECK STATUS"
    Next 'cell
    Application.EnableEvents = True
    End Sub

    Regards,TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    05-04-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another

    Thanks very much! Works great. How can we make "RECHECK STATUS" red and bold?

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another

    Try This.



    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Cells.Count > 1 Then Exit Sub
    
    Application.EnableEvents = False
            If Not Intersect(Target, Range("D:D")) Is Nothing Then
    
                Target(1, 2).Value = "Check Status"
                Target(1, 3).ClearContents
    
                Target(1, 2).select
    
        With Selection.Font
            .Name = "Calibri"
            .FontStyle = "Bold"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .Color = 255
            .TintAndShade = 0
            .ThemeFont = xlThemeFontMinor
        End With
    
       End If
            
                If Not Intersect(Target, Range("F:F")) Is Nothing And Target.Cells.Value = "Ok" Then
                
                Target(1, 0).ClearContents
                Target(1, 1).ClearContents
    
            End If
    Application.EnableEvents = True
    End Sub

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another

    This is a sheet specific macro.

    Enter anything in column D and Column E will ask to Check Status.

    Enter Ok into Column F will Clear entries in Column E and F.


    Because it is worksheet code, it is very easy to install and automatic to use:

    1. right-click the tab name near the bottom of the Excel window
    2. select View Code - this brings up a VBE window
    3. paste the stuff in and close the VBE window



    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Cells.Count > 1 Then Exit Sub
    
            If Not Intersect(Target, Range("D:D")) Is Nothing Then
    
                Target(1, 2).Value = "Check Status"
                Target(1, 3).ClearContents
            End If
            
                If Not Intersect(Target, Range("F:F")) Is Nothing And Target.Cells.Value = "Ok" Then
                
                Target(1, 0).ClearContents
                Target(1, 1).ClearContents
    
            End If
    
    End Sub

  6. #6
    Registered User
    Join Date
    05-04-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another

    Thank you very much. You even threw in another great technique for validating check status. How can we make "Check Status" red and bold?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,188

    Re: Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another

    Please note that if you make changes to cells on the sheet within the Change event handler, you need to disable event handling before you make the change(s) and re-enable it afterwards. If you do not do this, you can cause a loop which, at best, will cause a slight delay and, at worst, may cause Excel/VBA to fail.


    Regards, TMS

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,188

    Re: Macro that automatically inputs "RECHECK STATUS" in cell when date changes in another

    Not tested but combining mine and other's solutions:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cell As Range
    If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    For Each cell In Intersect(Target, Range("D:D"))
        With cell.Offset(0, 1)
            .Value = "RECHECK STATUS"
            With .Font
                .FontStyle = "Bold"
                .Color = 255
                .TintAndShade = 0
            End With
    End With
    Next 'cell
    Application.EnableEvents = True
    End Sub

    Regards, TMS

+ 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