WorksheetChange Event triggers 47 times?

KKaren

New Member
Joined
Jan 13, 2018
Messages
33
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:

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
 
Probably it depends on the PC then
I am guessing it might have to do with this, perhaps your internal memory of something along those lines.
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top