Ciao a tutti!!!
Vi chiedo ancora aiuto!!! Per favore!
non so come fare a modificare questo codice ... vorrei eseguirlo da un foglio differente, ma funziona solo se sono sul foglio dove sono presenti i dati.
Ecco il codice ...
codice:Private Sub UserForm_Activate() Dim I As Integer Dim CR As Range Me.Caption = Replace(ActiveWorkbook.Name, "Select_Maail.xlsm", "") Set CR = ActiveSheet.Cells(2, 1).CurrentRegion For I = 2 To CR.Rows.Count If CR.Cells(I, 1) <> "" Then Me.ListBox1.AddItem CR.Cells(I, 1) End If Next For I = 2 To CR.Rows.Count If CR.Cells(I, 36) <> "" Then Me.ListBox2.AddItem CR.Cells(I, 36) End If Next ListBox1.MultiSelect = 1 ListBox2.MultiSelect = 1 End Sub Prova.zip Private Sub UserForm_Terminate() Dim I As Integer Dim DUMMY As String DUMMY = "AJ2:AJ" + CStr(ActiveSheet.Cells(2, 36).End(xlDown).Row) ActiveSheet.Range(DUMMY).Clear For I = 0 To Me.ListBox2.ListCount - 1 ActiveSheet.Cells(I + 2, 36) = ListBox2.List(I) Next I End Sub
il allegato il file ...
Vorrei che dal foglio cruscotto cliccando il bottone il codice funzionasse...
Grazie in anticipo!!!

Rispondi quotando


