• Code Help (Excel 2000)

    Author
    Topic
    #428174

    I’m trying to get the text “Record Changed” to appear in
    column H of the row where the data was changed(A1 through D10). I don’t know all the syntax for VBA in excel but tried Offset
    because it looked like it does what I needed.
    It keeps the text in the same row but doesn’t keep it in column H.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Not Intersect(Target, Range("A1:D10")) Is Nothing Then
        With Range(Target.Address).Offset(, 7)
            .Cells = "Record Changed"
        End With
    End If
    End Sub
    Viewing 0 reply threads
    Author
    Replies
    • #994076

      .Offset(, 7) is the cell 7 columns to the right of the “Target” cell. Try this:

      Private Sub Worksheet_Change(ByVal Target As Range)
      Dim oCell As Range
      If Not Intersect(Target, Range(“A1:D10”)) Is Nothing Then
      For Each oCell In Intersect(Target, Range(“A1:D10”)).Cells
      Cells(oCell.Row, 8) = “Record Changed”
      Next oCell
      End If
      End Sub

    Viewing 0 reply threads
    Reply To: Code Help (Excel 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: