update a cell using VBA code example
Example 1: vba set cell value
Range("A2").Value = 1
Cells(2,1).Value = 1
Range("A2:A5").Value = 1 ' all cells in the range
Example 2: excel vba cell on change
' In your Worksheet code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Target.Worksheet.Range("A1")) Is Nothing Then
Application.EnableEvents = False
' Do your stuff
Application.EnableEvents = True
End If
End Sub