Hello,
I am a newbie in VBA and I have a question regarding the Worksheet_Change event. Let's say, anytime something changes in the worksheet, I want to write something in the next empty cell in column A. So I have the following simple code:
In the beginning, all cells in column A are empty, so I when I trigger this event, all cells from A1 to A47 have the value of "Beer". When I trigger it one more time, all cells to A94 have the value of "Beer".
Obviously, when Excel updates cell A1 with "Beer", this triggers the event once again and then it executes the part in the Else block and this process is being repeated, but my question is why exactly 47 times?!
I will be glad if somebody answers as I have tried searching here and at other forums as well but without any luck.
Thanks in advance and cheers
I am a newbie in VBA and I have a question regarding the Worksheet_Change event. Let's say, anytime something changes in the worksheet, I want to write something in the next empty cell in column A. So I have the following simple code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A" & Rows.Count).End(xlUp).Value = "" Then
Range("A" & Rows.Count).End(xlUp).Value = "Beer"
Else
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = "Beer"
End If
End Sub
In the beginning, all cells in column A are empty, so I when I trigger this event, all cells from A1 to A47 have the value of "Beer". When I trigger it one more time, all cells to A94 have the value of "Beer".
Obviously, when Excel updates cell A1 with "Beer", this triggers the event once again and then it executes the part in the Else block and this process is being repeated, but my question is why exactly 47 times?!
I will be glad if somebody answers as I have tried searching here and at other forums as well but without any luck.
Thanks in advance and cheers