Ciao Luciano,
Vorrei sapere se è possibile fare in modo che quando si inseriscono dati in un foglio, questi vengano automaticamente inseriti in un altro foglio.
Per esempio:
Nel foglio "Generale" ho tutte le prenotazioni.
Gli altri fogli sono i nomi di coloro che hanno effettuato le prenotazioni.
Voglio che quando inserisco un nuovo foglio con una nuova persona e inserisco i dati lì, gli stessi dati vengano inseriti automaticamente nel foglio "Generale", in base alla data.
PS. Di seguito il link per scaricare il file excel in questione:
https://docs.google.com/spreadsheets/d/1G-ljTDLjPm9rUnad8vtH6ykyk3EtmJCH/edit?usp=sharing&ouid=109796831966118151198&rtpof=true&sd=true
In attesa di ulteriori informazioni, prova qualcosa del genere:
- Alt+F11 per aprire l'editor di VBA
- Ctrl+R per accedere alla finestra Project Explorer ('Gestione progetti')
- Fai doppio clic sul modulo ThisWorkbook (Questa_cartella_di_Lavoro) del file e incolla il seguente codice:
'========>>
Option Explicit
'-------->>
Private Sub Workbook_SheetChange(ByVal SH As Object, ByVal Target As Range)
Dim destSH As Worksheet
Dim Rng As Range, srcRng As Range, destRng As Range
Dim dDate As Date
Const sFoglio_Generale As String = "Generale"
If SH.Name = sFoglio_Generale Then Exit Sub
Set Rng = Intersect(Target, SH.Columns("D"))
If Not Rng Is Nothing Then
If Not IsDate(Rng.Cells(1).Offset(, -3)) Then Exit Sub
Set srcRng = Rng.Offset(, -3).Resize(4)
Set destSH = ThisWorkbook.Sheets(sFoglio_Generale)
dDate = DateValue(srcRng.Cells(1).Value)
Set destRng = destSH.UsedRange.Find(What:=dDate, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
With destRng
If IsEmpty(.Cells(1, 2)) Then
.Cells(1, 2).Value = srcRng.Cells(1, 2).Value
.Cells(1, 3).Value = srcRng.Cells(1, 3).Value
.Cells(1, 4).Value = SH.Name
.Cells(1, 5).Value = srcRng.Cells(1, 4).Value
Else
Call MsgBox(Prompt:="la data " & dDate & " è già presa", _
Buttons:=vbCritical, _
Title:="REPORT")
Exit Sub
End If
End With
End If
End Sub
'<<========
- Alt+Q per chiudere l'editor di VBA e tornare a Excel
- Salva il file con l'estensione xlsm.
Potresti scaricarte il mio file di prova Luciano20230118.xlsm
A causa di un problema con l'attuale editor del forum, che inserisce righe vuote indesiderate nel codice copiato dal forum, suggerirei di copiare il mio codice direttamente dal mio file di prova.
===
Regards,
Norman

Nonostante abbia fatto ciò che mi hai detto non funziona, non fa nulla, come se non fosse inserito nulla