Christopher B. answered 10/11/19
Tutor
5
(18)
Well Versed Financial Professional & Financial Systems Expert
Hi, it sounds like you are referencing using VBA or a custom Macro. Below is some example code you can use to simulate what you have asked. To access the VBA screen in Excel just press Alt + F11 at the same time.
Example Code:
- Private Sub Worksheet_Change(ByVal Target As Range)
- vNew = Range("a1").Value
- Application.EnableEvents = False
- Application.Undo
- vOld = Range("a1").Value
- Range("a1").Value = vNew
- Application.EnableEvents = True
- If Selection.Count = 1 Then
- If vOld <> vNew Then
- ' Checks if cell A1 is clicked.
- If Not Intersect(Target, Range("A1")) Is Nothing Then
- Sheets.Add After:=ActiveSheet
- End If
- Else
- End If
- End If
- End Sub