Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao Chiara,
ho usato la formula =Foglio1!A2 inserita nella colonna A2 del Foglio 1.
Con Excel sono alle prime armi, abbiate pazienza....
Per raggiungere il tuo obiettivo prova a sostituire le formule su Foglio2 con i valori corrispondenti e poi prova qualcosa del genere:
- Fai clic dx sulla linguetta del Foglio1
- Seleziona l'opzione Visualizza Codice dal **** menu contestuale risultante
- Incolla il seguente codice:
'========>>
Option Explicit
'-------->>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range, rCell As Range
Const sSecondo_Foglio As String = "Foglio2" '<<=== Modifica
Set Rng = Intersect(Target, Me.Columns("A:B"))
If Not Rng Is Nothing Then
For Each rCell In Rng.Cells
With rCell
ThisWorkbook.Sheets(sSecondo_Foglio).Range(.Address).Value = .Value
End With
Next rCell
End If
End Sub
'<<========
- Alt+IM per inserire un nuovo modulo di codice
- Nel nuovo modulo vuoto, incolla il seguente codice:
'========>>
Option Explicit
Public Const sPrimo_Foglio_Sorgente As String = "Foglio1" '<<=== Modifica
Public Const sSecondo_Foglio As String = "Foglio2" '<<=== Modifica
'-------->>
Public Sub Ordina_Dati()
Dim WB As Workbook
Dim srcSH As Worksheet, destSH As Worksheet
Dim srcRng As Range, destRng As Range
Dim arrIn As Variant
Dim i As Long, j As Long
Dim LRow As Long
Set WB = ThisWorkbook
With WB
Set srcSH = .Sheets(sPrimo_Foglio_Sorgente)
Set destSH = .Sheets(sSecondo_Foglio)
End With
With srcSH
LRow = LastRow(srcSH, .Columns("A:A"))
Set srcRng = .Range("A1:C" & LRow)
End With
Set destRng = destSH.Range(srcRng.Address)
Call DoSort(srcRng)
Call DoSort(destRng)
End Sub
'-------->>
Public Sub DoSort(Rng As Range)
Rng.Sort Key1:=Rng.Cells(1, 1), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
'--------->>
Public Function LastRow(SH As Worksheet, _
Optional Rng As Range, _
Optional minRow As Long = 1)
If Rng Is Nothing Then
Set Rng = SH.Cells
End If
On Error Resume Next
LastRow = Rng.Find(What:="*", _
After:=Rng.Cells(1), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
If LastRow < minRow Then
LastRow = minRow
End If
End Function
'<<========
- Alt+Q per chiudere l'editor di VBA e tornare a Excel
- Salva il file con l’estensione xlsm
- Alt+F8 per aprire la finestra di gestione delle macro
- Seleziona Tester
- Esegui
In alternativa, inserisce un pulsante sul Foglio1 e assegna la macro Tester al pulsante.
Potresti scaricare il mio file di prova Chiara20200903.xlsm
===
Regards,
Norman