Thread: [Solved] Excel cells changing values
View Single Post
 
Old 02-24-2016, 05:08 AM
Philb1 Philb1 is offline Windows 10 Office 2010 32bit
Advanced Beginner
 
Join Date: Feb 2016
Location: Auckland
Posts: 43
Philb1 is on a distinguished road
Default

Hello theexpat

I'm one of those as well

Put this code in the sheet module by right clicking the sheet tab, click view code & paste it in the module.
Enter whatever in A1 press enter & do it again etc

Cheers

Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Target2 As Range
Dim Lrow As Long
Set Target2 = Me.Cells(1, 1) ' Cell A1

On Error GoTo ExitOut

If Not Intersect(Target, Target2) Is Nothing Then

    Application.EnableEvents = False
    
    If IsEmpty(Target2.Offset(, 1)) Then
        Target2.Offset(, 1) = Target
        GoTo ExitOut
        
    Else
        Lrow = Me.Columns(2).Find(What:="*", LookIn:=xlValues, _
                LookAt:=xlPart, SearchOrder:=xlByRows, searchdirection:=xlPrevious, _
                MatchCase:=False, SearchFormat:=False).Row
        
        Target.Offset(Lrow, 1) = Target2
        GoTo ExitOut
    End If
    
    Else
    GoTo ExitOut
End If

ExitOut:
Application.EnableEvents = True
On Error GoTo 0
Exit Sub

End Sub
Attached Files
File Type: xlsm A1ChangeExample.xlsm (15.7 KB, 12 views)
Reply With Quote