duteberta
Board Regular
- Joined
- Jun 14, 2009
- Messages
- 92
- Office Version
- 365
- Platform
- MacOS
Here is the VBA script I wrote to add a new table row at top of table and automatically fill in the ID column by running a macro only in that cell. The macro works fine on its own but I cannot get it to work here. The idea is that a new GUID is auto entered into the ID column of my new row.
VBA Code:
Sub AddRecordToTable()
Dim ws As Worksheet
Dim newRow As ListRow
Set ws = ActiveSheet
Set newRow = ws.ListObjects("tbl_PROP").ListRows.Add(1)
With newRow
.Range("PROP[ID]") = GenerateGUID
End Sub