salve,
vorrei sapere come fare ad estrarre da una tabella tipo: cognome nome ecc.. tutti i cognomi che iniziano per "A" e metterli in una colonna e poi accanto quelli che iniziano per "B" e così via.
grazie
Moderatori: Anthony47, Flash30005
Worksheets("Foglio1").Select
M_Iniz = ""
Iniz = ""
Sheets("Foglio2").Select
Cells.ClearContents
Sheets("Foglio1").Select
UC1 = Worksheets("Foglio1").Range("IV1").End(xlToLeft).Column
UR1 = Worksheets("Foglio1").Range("A" & Rows.Count).End(xlUp).Row
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal
Range("A1").Select
For RR1 = 1 To UR1
If RR1 = 1 Then
UC2 = Worksheets("Foglio2").Range("IV1").End(xlToLeft).Column + 1
Worksheets("Foglio1").Range(Cells(1, 1), Cells(1, UC1)).Copy Destination:=Worksheets("Foglio2").Cells(1, UC2)
M_Iniz = UCase(Mid(Worksheets("Foglio1").Cells(RR1 + 1, 1).Text, 1, 1))
Else
Iniz = UCase(Mid(Worksheets("Foglio1").Cells(RR1, 1).Text, 1, 1))
If M_Iniz <> Iniz Then
UC2 = Worksheets("Foglio2").Range("IV1").End(xlToLeft).Column + 2
Worksheets("Foglio1").Range(Cells(1, 1), Cells(1, UC1)).Copy Destination:=Worksheets("Foglio2").Cells(1, UC2)
UR2 = Worksheets("Foglio2").Range("A" & Rows.Count).End(xlUp).Row + 1
Worksheets("Foglio1").Range(Cells(RR1, 1), Cells(RR1, UC1)).Copy Destination:=Worksheets("Foglio2").Cells(UR2, UC2)
Else
UR2 = Worksheets("Foglio2").Cells(Rows.Count, UC2).End(xlUp).Row + 1
Worksheets("Foglio1").Range(Cells(RR1, 1), Cells(RR1, UC1)).Copy Destination:=Worksheets("Foglio2").Cells(UR2, UC2)
M_Iniz = Iniz
End If
End If
Next RR1
Sheets("Foglio2").Select
Columns("A:A").Delete Shift:=xlToLeft
Range("A1").Select
End Sub
Torna a Applicazioni Office Windows
Excel: formula automatica per evidenziare prodotto scaduto Autore: gamma_ray |
Forum: Applicazioni Office Windows Risposte: 3 |
Salvare file excel in formato html escludendo le immagini Autore: systemcrack |
Forum: Applicazioni Office Windows Risposte: 10 |
formula excel non visualizza risultato Autore: tommasog |
Forum: Applicazioni Office Windows Risposte: 6 |
Excel 2016 - Funzione SCARTO + INDIRETTO Autore: pl1957 |
Forum: Applicazioni Office Windows Risposte: 2 |
Visitano il forum: Nessuno e 88 ospiti