data la macro sottostante che funziona bene, ho alcuni aggiustamenti da fare che non riesco a fare…:
- Codice: Seleziona tutto
Sub Compila()
Application.ScreenUpdating = False '<<<< evita l'aggiornamento schermate (sfarfallio)
Application.Calculation = xlManual '<<<< ferma il calcolo e velocizza la macro
Set Ws1 = Worksheets("RIEPILOGO ORDINI")
Set Ws2 = Worksheets("INCOLONNA")
Set Ws3 = Worksheets("PARTICOLARI")
Set Ws4 = Worksheets("COMMERCIALI")
UC1 = Ws1.Cells(1, Columns.Count).End(xlToLeft).Column
Ws2.Cells.Clear
Ws3.Cells.Clear
Ws4.Cells.Clear
For CCR = 1 To UC1 - 4 Step 11
UR1 = Ws1.Range("A" & Rows.Count).End(xlUp).Row
Ws1.Range(Ws1.Cells(2, CCR), Ws1.Cells(UR1, CCR + 10)).Copy
Ws2.Select
UR2 = Ws2.Range("A" & Rows.Count).End(xlUp).Row + 1
Range("A" & UR2).Select
ActiveSheet.Paste
Next CCR
UR2 = Ws2.Range("A" & Rows.Count).End(xlUp).Row
For RR2 = UR2 To 1 Step -1
If Ws2.Range("C" & RR2).Value = 0 Or Ws2.Range("B" & RR2).Value = "Ins." Or Ws2.Range("C" & RR2).Value = "" Then Rows(RR2).Delete
If RR2 > 5 And Ws2.Range("B" & RR2).Value = "POS" Then Rows(RR2).Delete
Next RR2
UR2 = Ws2.Range("A" & Rows.Count).End(xlUp).Row
For RR2 = 1 To UR2
If Val(Ws2.Range("E" & RR2)) >= 1 And Val(Ws2.Range("E" & RR2)) <= 299999 Then
Ws2.Range("A" & RR2 & ":K" & RR2).Copy Destination:=Ws3.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Else
Ws2.Range("A" & RR2 & ":K" & RR2).Copy Destination:=Ws4.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next RR2
Ws2.Range("A1:K1").Copy Destination:=Ws3.Range("A1")
Ws2.Range("A1:K1").Copy Destination:=Ws4.Range("A1")
Application.Calculation = xlCalculationAutomatic '<<<< ripristina il calcolo
Application.ScreenUpdating = True '<<<< ripristina l'aggiornamento schermate
End Sub
premetto che questa macro miracolosa... mi permette di andare a copiare tutta una serie di valori da dai file esterni chiusi
e di utilizzarli mettendoli in colonna in base ad alcune mie necessità.
1) necessito di trasformare il
Ws2.Cells.Clear
Ws3.Cells.Clear
Ws4.Cells.Clear
in un istruzione che mi pulisca tute le righe tranne la prima che mi necessita come titolo fisso e conseguentemente dovrò andare a scrivere sul Ws2,Ws3,Ws4 a aprtire dall 2^ riga e non dalla 1^ come adesso
2) come faccio a dire di evidenziare i bordi delle celle dei vari Ws2,Ws3,Ws4 in modo che siano "tutti i bordi" di tutte le colonne da A:K per le sole righe compilate e non altre?
Anthony mi aveva già risposto ad un problema similare ma…mi sto annodando
grazie per l'aiuto!