Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:51:14+00:00 2026-06-13T14:51:14+00:00

I wonder whether someone may be able to help me please. I’m using the

  • 0

I wonder whether someone may be able to help me please.

I’m using the code below to track changes to a Excel worksheet, automatically inserting a date into column ‘A’ and the word ‘No’ into column ‘AE’ when the value of any cell within the range B5:Q2000 is changed.

Option Explicit
    Public preValue As Variant
    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim Cell As Range, res As Variant
      If Target.Cells.Count > 1 Then Exit Sub
       On Error Resume Next
       If Not Intersect(Target, Range("B5:Q2000")) Is Nothing Then
       If Target.Value <> preValue And Target.Value <> "" Then
            Application.EnableEvents = False
            Range("A5:A" & Target.Row).Value = Date
            Range("AE5:AE" & Target.Row).Value = "No"
            Application.EnableEvents = True
            Target.ClearComments
          '  Target.AddComment.Text Text:="Previous Value was " & preValue & Chr(10) & "Revised " & Format(Date, "dd-mm-yyyy") & Chr(10) & "By " & Environ("UserName")
            Target.Interior.ColorIndex = 35
        End If
    End If
    On Error GoTo 0

    End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Count = 1 Then preValue = Target.Value
End Sub

Unfortunately I’ve come across a problem which I’m not sure how to resolve.

If the user inserts data into cells D5 and D10, the date and the word ‘No’ are added to the correct columns (A and AE) for these two rows.

However, unfortunately, the ‘No’ value and the date are also added to the these columns for the rows in between i.e D6-D9, even though the user hasn’t entered any other data on these rows, and I’m not sure where the problem lies.

I just wondered whether someone may be able to take a look at this and offer some guidance on how I may go about solving this.

Many thanks and kind regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:51:15+00:00Added an answer on June 13, 2026 at 2:51 pm

    Your current code is applying the changes starting with A5 and AE5 through Target's row. To have the code change only the rows of the selected cell, change this:

    Range("A5:A" & Target.Row).Value = Date
    Range("AE5:AE" & Target.Row).Value = "No"
    

    to this:

    Range("A" & Target.Row).Value = Date
    Range("AE" & Target.Row).Value = "No"
    

    Also, you don’t seem to be using the variable Cell or res. You might want to delete that line of code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone may be able to help me please. The code below
I wonder whether someone may be able to help me please. The code below
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I'm using Aurigma
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I'm using this
I wonder whether someone may be able to help me please. Using some excellent
I wonder whether someone may be able to help me please. I am using
I wonder whether someone may be able to help me please. I'm using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.