I have some simple code that copies values from one workbook into another. When this is done, I want to add a timestamp (in a variable called dtStaticDate) to the copied cells in both the source and destination files. I need to select the blank cells in a table called "StaffWork" in the column headed "Logged". I have been trying this code:
This sometimes works fine, but sometimes (and I don't know what makes it happen) it selects either the entire sheet or all the cells in and above the table. What am I doing wrong? There are always one or more new cells to log, as I don't do this if no records have been copied. I have tried filtering the table and using xlTypeVisible instead, but the problem persists.
Code:
Range("StaffWork[Logged]").SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = dtStaticDate