Over time I've developed this highly enforced workbook where end users can paste data and then SQL code is generated for me to input the data into our dB. The only worksheet in question here is the "data" worksheet, as well as some VBA code contained in the "ThisWorkbook" area.
Currently the workbook is doing everything I want it to - it is correctly enforcing that the data being pasted or entered matches the Data Validation settings (and not overwriting data validation settings by changing any Paste function to a data-only paste function), and prompting the user to correct the data if it doesn't meet the criteria.
Beyond just pasted data, I needed to implement code to also validate the data if the end user manually typed in a cell; I did that by setting up VBA to execute on any workbook change, which calls the postPasteValidation Sub and confirms that data entered matches.
![]()
Please Login or Register to view this content.
The issue comes up when an end user edits a single cell - such as typing a note entry in Column N "W_Notes"; when they do this, it rechecks validation on EVERY cell in the worksheet (up to my defined range of 1001 rows). That takes approximately 45 seconds, which is not really an efficient use of time to write in a note in a single cell.![]()
Please Login or Register to view this content.
I've tried changing the setting in postPasteValidation from xlCellTypeALLValidation to xlCellTypeSameValidation, but that didn't seem to even decrease the amount of time for processing.
I'm OK with the "postPasteValidation" Sub running only 1 time before they close the workbook, and at that time checking all cells in the target range (and removing it from being called within the Paste and Workbook_Change Subs); but when I tried to move this code out to a Before_Close or Before_Save area, it wouldn't run.![]()
Please Login or Register to view this content.
I've attached a blank of the workbook here; the password to unlock the "data" tab is PW . I'm open to any and all suggestions, the end users love this workbook, but not the 45 second wait any time they need to edit a cell!
David
Bookmarks