Ordenar Productos por orden Alfabético
Tengo un libro con un formulario en el cual aparecen en un combo box un listado de artículos, y quisiera que aparecieran por orden alfabético, pero no se como hacerlo, os pongo la macro del formulario a ver si se puede modificar de alguna forma, para que los productos aparezcan por orden alfabético.
Private Sub ComboBox1_Change()'Por.Dante Amor Set h1 = Sheets("Hoja1") Set h2 = Sheets("Hoja2") h2.Cells.ClearContents If ComboBox1.ListIndex > -1 Then f = ComboBox1.ListIndex + 6 uc = h1.Cells(4, Columns.Count).End(xlToLeft).Column i = 1 For j = 3 To uc If h1.Cells(f, j) <> "" Then h2.Cells(i, "A") = h1.Cells(4, j) h2.Cells(i, "B") = h1.Cells(f, j) i = i + 1 End If Next ' u = h2.Range("A" & Rows.Count).End(xlUp).Row With h2.Sort .SortFields.Clear: .SortFields.Add Key:=h1.Range("B1:B" & u) .SetRange h1.Range("A1:B" & u): .Header = xlGuess: .Apply End With ListBox1.RowSource = h2.Name & "!A1:B" & u End IfEnd Sub'Private Sub UserForm_Activate()'Por.Dante Amor Set h1 = Sheets("Hoja1") Set h2 = Sheets("Hoja2") ComboBox1.RowSource = h1.Name & "!A6:A" & h1.Range("A" & Rows.Count).End(xlUp).Row ListBox1.ColumnCount = 2 ListBox1.ColumnWidths = 300 & ";" & 50End Sub'Private Sub CommandButton1_Click()'Por.Dante Amor Unload MeEnd Sub
1 Respuesta
Respuesta de Dante Amor
1