Hello, as the title says, I would like to populate the text box of a UserForm1 data from the last row of the first column of the active worksheets table. The commented-out section is what I'm having a problem with. I want to pre-populate a couple textboxes in the form with editable data, and allow the user to finish the form, and post any changes within that same row.
Thank you,
Dan
VBA Code:
Sub ShowForm_Initialize()
Dim wb As Workbook
Dim ws As Worksheet
Dim NewRow As ListRow
Dim tbl As ListObject
Dim frm As UserForm1
Set wb = ThisWorkbook
Set ws = wb.Sheets("FY")
Set tbl = ws.ListObjects("Data")
Set NewRow = tbl.ListRows.Add
With NewRow
.Range(6) = Now()
.Range(5) = tbl.DataBodyRange.Rows.Count
.Range(1).Value = NewRow.Range(4).Value & "-" & "DCATL" & "-" & NewRow.Range(3)
End With
'With frm
' .ShipmentIDTextBox.Value = tbl.DataBodyRange(??, 1).Value
'End With
UserForm1.Show
End Sub
Thank you,
Dan