Un saluto a Voi,
posso chiedere il Vostro aiuto per il codice sottostante che va in errore nella riga
Set newrow = tbl.ListRows.Add
La routine prende alcuni dati da una userform e altri li aggiunge nella nuova riga della tabella "Tbl_Inventario"
Private Sub AddRow()
If Not IsNumeric(TextBox1.Value) Then
Dim Cancel As Boolean
MsgBox "Totale €: inserire solo numeri"
Cancel = True
Me.TextBox1.SetFocus
Exit Sub
End If
Workbooks("INVENTARIO.xlsm").Sheets("Storico").Activate
Dim LastRow As Long
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Dim ws As Worksheet
Set ws = ActiveSheet
Dim tbl As ListObject
Set tbl = ws.ListObjects("Tbl_Inventario")
Dim newrow As ListRow
Set newrow = tbl.ListRows.Add
With newrow
.Range(1) = ActiveSheet.Cells(LastRow, "A").Value + 1
.Range(16) = StrConv(UCase((Format(Date, "mmmm"))), vbProperCase)
.Range(17) = Year(Now()) '"=R[-1]C"
.Range(17).NumberFormat = "General"
.Range(18) = Application.WorksheetFunction.WeekNum(Now, vbMonday) - 0
.Range(13) = CDbl(Format(Me.TextBox1.Value, "#,##0.00"))
.Range(10) = Me.ComboBox3.Value
.Range(9) = Me.ComboBox2.Value
.Range(2) = Me.ComboBox1.Value
End With
Range("M" & Cells(Rows.Count, "M").End(xlUp).Row).Select
End Sub
Grazie per il Vostro aiuto.
Ciao
Giovanni