Ciao
Dovrei copiare alcuni dati da un foglio a un altro, definiti da 3 variabili.
Ho scritto una macro che mi definisce le variabili, ma non riesco a copiare i dati che mi servono nella riga desiderata.
Sub Esporta()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim Var1 As String
Dim Var2 As String
Dim Var3 As String
Dim Var4 As String
Dim Var5 As String
Dim Var6 As String
Dim I As Integer
Dim X As Integer
Dim y As Integer
For I = 6 To 997
For X = 21 To 250
For y = 7 To 110
For Each ws In ActiveWorkbook.Worksheets
Var1 = ws.Cells(1, 1) 'Assegno il valore della cella F2 alla variabile Var1
Var2 = Sheets("ORDINI").Cells(I, 2) 'Assegno il valore della cella B2 alla variabile Var2
Var3 = ws.Cells(X, 4) 'Assegno il valore della cella F2 alla variabile Var1
Var4 = Sheets("ORDINI").Cells(I, 4) 'Assegno il valore della cella B2 alla variabile Var2
Var5 = ws.Cells(X, 3) 'Assegno il valore della cella F2 alla variabile Var1
Var6 = Sheets("ORDINI").Cells(I, 5) 'Assegno il valore della cella B2 alla variabile Var2
If Var1 = Var2 Then 'Se le due variabili sono uguali..
If Var5 = Var6 Then
If Var3 = Var4 Then
ws.Rows("Test").Activate
' ActiveSheet.Range(Cells(I, 7), Cells(I, 110)).Copy
' ws.Cells(X, 5).Paste
End If
End If
End If
Next
Next
Next
Next
Application.ScreenUpdating = True
End Sub