dodo47, 05/04/2021 10:42:Ciao dopo aver cambiato il nome della Txt_Destrizione in Txt_Descrizione (che mi sembra più corretto) ed aver sostituito la txtRiferimento con la ComboBox1, potresti fare nel seguente modo: Private Sub UserForm_initialize() Dim ur As Long ur = Foglio2.Cells(Rows.Count, 2).End(xlUp).Row With ComboBox1 .List = Foglio2.Range("A2:A" & ur).Value End With Me.ComboBox1.SetFocus End Sub Private Sub ComboBox1_AfterUpdate() Dim ur As Long, rng As Range ur = Foglio2.Cells(Rows.Count, 2).End(xlUp).Row valore = Application.VLookup(ComboBox1.Value, Foglio2.Range("A2:B" & ur), 2, 0) If IsError(valore) Then MsgBox "Riferimento inesistente" Me.ComboBox1.Value = "" Me.Txt_Descrizione = "" Else Me.Txt_Descrizione = valore End If End Sub Private Sub Cmd_Registra_Click() Dim ur As Long ur = Foglio1.Cells(Rows.Count, 1).End(xlUp).Row With Foglio1 .Cells(ur + 1, 1).Value = Me.ComboBox1.Value .Cells(ur + 1, 2).Value = Me.Txt_Descrizione.Value .Cells(ur + 1, 3).Value = Me.Txt_qta_car.Value .Cells(ur + 1, 4).Value = Me.Txt_qta_scar.Value .Cells(ur + 1, 5).Value = Me.Txt_Prezzo.Value .Cells(ur + 1, 6).Value = Me.Txt_listino.Value .Cells(ur + 1, 7).Value = Me.Txt_sconto.Value .Cells(ur + 1, 10).Value = Me.Txt_data.Value End With Me.Hide MsgBox Me.ComboBox1.Value & " registrato alla riga " & ur + 1, vbInformation, "REGISTRATO" Unload Me End Sub Private Sub CMD_Esci_Click() Unload Me End Sub Infine ti suggerisco di creare nomi variabili descrittivi per i nomi dei fogli e non riferirti a Foglio1 o Foglio2 per una migliore lettura del codice, per esempio: dim mAppo as worksheet set mAppo=worksheets("APPO") e nel codice diferirti a mAppo e non a Foglio2 saluti
Private Sub UserForm_initialize() Dim ur As Long ur = Foglio2.Cells(Rows.Count, 2).End(xlUp).Row With ComboBox1 .List = Foglio2.Range("A2:A" & ur).Value End With Me.ComboBox1.SetFocus End Sub Private Sub ComboBox1_AfterUpdate() Dim ur As Long, rng As Range ur = Foglio2.Cells(Rows.Count, 2).End(xlUp).Row valore = Application.VLookup(ComboBox1.Value, Foglio2.Range("A2:B" & ur), 2, 0) If IsError(valore) Then MsgBox "Riferimento inesistente" Me.ComboBox1.Value = "" Me.Txt_Descrizione = "" Else Me.Txt_Descrizione = valore End If End Sub Private Sub Cmd_Registra_Click() Dim ur As Long ur = Foglio1.Cells(Rows.Count, 1).End(xlUp).Row With Foglio1 .Cells(ur + 1, 1).Value = Me.ComboBox1.Value .Cells(ur + 1, 2).Value = Me.Txt_Descrizione.Value .Cells(ur + 1, 3).Value = Me.Txt_qta_car.Value .Cells(ur + 1, 4).Value = Me.Txt_qta_scar.Value .Cells(ur + 1, 5).Value = Me.Txt_Prezzo.Value .Cells(ur + 1, 6).Value = Me.Txt_listino.Value .Cells(ur + 1, 7).Value = Me.Txt_sconto.Value .Cells(ur + 1, 10).Value = Me.Txt_data.Value End With Me.Hide MsgBox Me.ComboBox1.Value & " registrato alla riga " & ur + 1, vbInformation, "REGISTRATO" Unload Me End Sub Private Sub CMD_Esci_Click() Unload Me End Sub