Forum Discussion
VBA needs to identify a newly formatted table
Since you say "I simply reformat my selected cell range into a table", the result is a "range table". To verify this, you can execute (e.g., in the Immediate window):
Debug.Print ActiveSheet.ListObjects("Table1").SourceType
and you will see a value of 1. (You can view the list of other possible table source types in the Object Browser; it's the enumeration XlListObjectSourceType.) I don't know if my answers will work for other table source types.
Your code shows column letters, but does not mention the table's column names, which are important when working with tables. I put together a T&M spreadsheet that contains some data in a worksheet range, and other similar data in a table named Table1. I made a guess at column names (and in one case, the type of column content as well), and where I did not include a name, Excel assigned them:
So for my table, the Start Time is recorded when a Task (name/description) is entered, and the End Time and Duration are recorded when the Compln By value is entered.
The procedures that correspond to Initialize, Start_Time, and End_Time are PopulateNewTable1Row, RecordTheStartTime, and RecordTheEndTime, respectively. I make frequent use of the With statement to reduce the visual clutter (and likely slightly improve performance); it's documented in this Microsoft documentation. But the significant difference is that the code in the latter procedures uses the table's properties rather than the worksheet's properties.
(I don't have knowledge of the conditions under which your procedures are called; I tried to invoke the Record...Time procedures only when the last row with a Task was changed in either the Task or Compln By columns. I thought that the TableUpdate event might be triggered, but for most of my changes, it was not.)