Ciao Massimo,
relativamente al Pulsante di comando "Inserisci" la questione non è molto diversa da quel codice già da me postato. Riguardo il foglio occorrerà fare una pulizia delle celle del foglio di inserimento dati, almeno di quelle della colonna A che usiamo come
riferimento per valutare in quale riga immettere i dati. Inoltre, visto che l'area dati è limitata in basso, la ricerca della prima riga libera dovrà essere fatta dalla riga 81 in su.
Questo un esempio:
' Module: UserForm2
'
Option Explicit
Private Const mcstrFoglio As String = "Foglio1"
Private Const mcstrStart As String = "A4"
Private Const mcstrColST_ As String = "A"
Private Const mcstrColOgg As String = "B"
Private Const mcstrColRFR As String = "C"
Private Const mcstrColOwn As String = "D"
Private Const mcstrColApp As String = "E"
Private Const mcstrColAmb As String = "G"
Private Const mcstrColDat As String = "H"
Private Sub cmdInserisci_Click()
On Error GoTo ExtP
Dim wbk As Excel.Workbook
Dim wsh As Excel.Worksheet
Dim r As Long
Set wbk = Excel.Application.ThisWorkbook
Set wsh = wbk.Worksheets(mcstrFoglio)
With wsh.Range(mcstrStart)
r = .Worksheet.Cells(81, _
.Column _
).End(xlUp).Row + 1
End With
With wsh
.Range(mcstrColST_ & r).Value = Me.txtST.Value
.Range(mcstrColOgg & r).Value = Me.txtoggetto.Value
.Range(mcstrColRFR & r).Value = Me.txtRFR.Value
.Range(mcstrColOwn & r).Value = Me.cboowner.Value
.Range(mcstrColApp & r).Value = Me.cboapplicativo.Value
.Range(mcstrColAmb & r).Value = Me.cboambiente.Value
.Range(mcstrColDat & r).Value = Me.cbodata.Value
End With
ExtP:
With Err
If .Number Then MsgBox .Description, _
vbOKOnly Or vbCritical, _
"ERRORE#" & .Number
End With
On Error Resume Next
Set wsh = Nothing
Set wbk = Nothing
End Sub