ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code WAY too slow... (worksheet_change event) (https://www.excelbanter.com/excel-programming/320546-code-way-too-slow-worksheet_change-event.html)

[email protected]

Code WAY too slow... (worksheet_change event)
 
I am working with a spreadsheet that has several thousand rows. I
wanted to be able to track when rows have been added or updated so I
wrote a simple macro that adds the current date to the last column
whatever row changed.

'Private Sub Worksheet_Change(ByVal Target As Range)
'For Each cell In Target
' Sheet9.Cells(cell.Row, 19) = Date
' Application.EnableEvents = True
'Next cell
'End Sub

This works great when someone simply changes a value, but if I add a
NEW row (by copying a line and inserting it below) the code above takes
nearly a minute to complete. How can I make it faster?



All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com