VisitorsVBA ha scritto:Devo svegliarmi, ancora....
Volevo aggiungere il codice:
Application.ScreenUpdating = False
Dim c1, c2, c3, Intervallo As Range
Sheets("Foglio2").Select
Set c1 = Range([A2], [A65536].End(xlUp))
Set c2 = Range([H2], [H65536].End(xlUp))
Set c3 = Range([O2], [O65536].End(xlUp))
c1.Copy Worksheets("Foglio1").Range("A2")
c2.Copy Worksheets("Foglio1").Range("B2")
c3.Copy Worksheets("Foglio1").Range("C2")
Dim c11, c22, c33, Intervallo3 As Range
Sheets("Foglio3").Select
Set c11 = Range([A4], [A65536].End(xlUp))
Set c22 = Range([H4], [H65536].End(xlUp))
Set c33 = Range([O4], [O65536].End(xlUp))
' trova le celle vuote e copia
Foglio1.Activate
Range("a2").Activate
Application.ScreenUpdating = True
Una domanda che vi pongo dopo la suddetta soluzione è questa:
La stessa cosa si può fare utilizzando le matrici?
Ho fatto in questo modo ma non mi piace. Voi cosa dite?
Sub copiaincollaOK()
Application.ScreenUpdating = False
Dim c1, c2, c3, Intervallo As Range
Sheets("Foglio2").Select
Set c1 = Range([A2], [A65536].End(xlUp))
Set c2 = Range([H2], [H65536].End(xlUp))
Set c3 = Range([O2], [O65536].End(xlUp))
c1.Copy Worksheets("Foglio1").Range("A2")
c2.Copy Worksheets("Foglio1").Range("B2")
c3.Copy Worksheets("Foglio1").Range("C2")
Dim c11, c22, c33, Intervallo3 As Range
Sheets("Foglio3").Select
Set c11 = Range([A4], [A65536].End(xlUp))
Set c22 = Range([H4], [H65536].End(xlUp))
Set c33 = Range([O4], [O65536].End(xlUp))
Sheets("Foglio1").Activate
Range("A20").Select
Do
ActiveCell.End(xlUp).Select
Loop Until ActiveCell.Value <> ""
ActiveCell.Offset(1).Select
c11.Copy ActiveCell
Range("B20").Select
Do
ActiveCell.End(xlUp).Select
Loop Until ActiveCell.Value <> ""
ActiveCell.Offset(1).Select
c22.Copy ActiveCell
Range("C20").Select
Do
ActiveCell.End(xlUp).Select
Loop Until ActiveCell.Value <> ""
ActiveCell.Offset(1).Select
c33.Copy ActiveCell
Range("a2").Activate
Application.ScreenUpdating = True
End Sub