Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert date near cell... (2000 sr-1)

    I have this code to insert value in cells column L, how to update this code about:

    After i have insert 1 or 2 in cells of column L insert in cell M , into related cell, the date format dd/mm/yyyy and if i cancel the value in cell column M automaticly cancel the related date in M...

    Option Explicit
    Dim rTargetCell As Range
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    With Target
    If .HasFormula Then Exit Sub
    If .Column <> 12 Then Exit Sub ' COLONNA L = 12
    If IsEmpty(Target) Then Exit Sub
    End With

    Set rTargetCell = Target
    If IsNumeric(Target) Then
    Excuses
    End If

    Set rTargetCell = Nothing

    End Sub
    Private Sub Excuses()
    Application.EnableEvents = False
    Select Case rTargetCell.Value
    Case Is = 1
    rTargetCell.Value = "SIST. A NOSTRA CURA"
    Case Is = 2
    rTargetCell.Value = "SIST. A CURA CLIENTE"
    'Case Is = 3
    ' rTargetCell.Value = "NUOVA NOTA"
    Case Else
    rTargetCell.Value = "NOTA INESISTENTE!"
    End Select
    Application.EnableEvents = True
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Insert date near cell... (2000 sr-1)

    The cell to the right of rTargetCell is rTargetCell.Offset(0, 1).

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert date near cell... (2000 sr-1)

    No work.... is correct?

    Private Sub Excuses()
    Application.EnableEvents = False
    Select Case rTargetCell.Value
    Case Is = 1
    rTargetCell.Value = "SIST. A NOSTRA CURA"
    rTargetCell.Value(0, 1) = CDate(Now)
    Case Is = 2
    rTargetCell.Value = "SIST. A CURA CLIENTE"
    rTargetCell.Value(0, 1).Value = Format(CDate(Now), "DD/MM/YYYY")
    'Case Is = 3
    ' rTargetCell.Value = "NUOVA NOTA"
    Case Else
    rTargetCell.Value = "NOTA INESISTENTE!"
    End Select
    Application.EnableEvents = True
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Insert date near cell... (2000 sr-1)

    Please read my previous reply carefully.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •