Moderatori: Anthony47, Flash30005
Sub Zagor()
Dim I As Long, deSh As String, NextR As Long
'
Sheets("FoglioDati").Select '<<< Il foglio di partenza
'
For I = 1 To Cells(Rows.Count, "B").End(xlUp).Row
If IsDate(Cells(I, "B").Value) Then
deSh = Format(Cells(I, "B"), "mmmm")
NextR = Sheets(deSh).Cells(Rows.Count, "B").End(xlUp).Row + 1 '**
Cells(I, 2).Resize(1, 6).Copy Sheets(deSh).Cells(NextR, "B") '**
End If
Next I
MsgBox ("Spezzatino completato...")
End Sub
Sub CancellaDati()
'
' CancellaDati
'
Application.ScreenUpdating = False
'
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> copia l'intero anno in archivio
'
If UCase(Sheets("MENU").Range("L2")) <> "PROCEDI" Then '<<<<<<<<<Condizione di conferma se salvare o non salvare
ActiveSheet.Unprotect
MsgBox ("ATTENZIONE......Dati non Caricati Inserire <<< PROCEDI >>> Nella Cella di colore Rosso")
Range("L2").Interior.ColorIndex = 3 '..........la cella si colora di rosso
Range("L2").Select
Range("B12").Select
Selection.Copy
Range("M2").Select
ActiveSheet.Paste
Range("L2").Select
MsgBox ("INSERISCI ( PROCEDI ) NELLA CELLA ROSSA E ...... RIPETI OPERAZIONE")
Exit Sub
End If
'MsgBox ("RIPETI OPERAZIONE")
'....
'
'Range("AZ6").Interior.ColorIndex = 2 '..........la cella si colora di bianco
'...
'Call myLink(myName)
On Error GoTo 0
RISPO = MsgBox("L'Anno in Corso verrà Archiviato e i dati verranno cancellati!" & vbCrLf & " " & vbCrLf & " Si Prega scegliere " & vbCrLf & " " & vbCrLf & "Si per continuare , No per interrompere senza copiare e cancellare", vbYesNo + vbExclamation)
If RISPO <> vbYes Then
MsgBox ("Il file non e' stato Copiato e azzerato...")
Exit Sub
End If
'.......
Range("L2").Interior.ColorIndex = 2 '..........la cella si colora di bianco
'UserForm1.Show vbModeless
'DoEvents
MsgBox (" Inizio copia Integrale del File.....Premere OK ")
Range("a1").FormulaR1C1 = "=today()"
nome = "D:\excel\Archivio Prima nota cassa ditta SRL\Prima Nota Cassa srl Anno " & Format([A1], "dd-mm-yyyy") & ".xlsm"
'MsgBox (nome)
ActiveWorkbook.SaveCopyAs Filename:=nome
MsgBox (" Inizio Preparazione Anno Nuovo.....Premere OK ")
Range("L2").Select
Selection.ClearContents
Range("M2").Select
Selection.ClearContents
'
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Fine copia in archivio
'
'>>>>>>>>>>>>>>>>> Cambio numero dell'anno
'
Sheets("liste").Select
ActiveSheet.Unprotect
Range("H2").Select
Selection.Copy
Range("I2").Select
ActiveSheet.Paste
Range("H2").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("K2").Select
Selection.Copy
Range("H2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'
'>>>>>>>>>>>>>>>>>>>Riporto a NUOVO i saldi di fine anno
'
Sheets("Dic").Select
ActiveSheet.Unprotect
Range("K4").Select
Selection.Copy
Sheets("liste").Select
Application.CutCopyMode = False
ActiveSheet.Unprotect
Range("H6").Select
Sheets("Dic").Select
Selection.Copy
Sheets("liste").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Dic").Select
Range("N6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("liste").Select
Range("J6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Dic").Select
Range("R4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("liste").Select
Range("L6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Dic").Select
Range("U4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("liste").Select
Range("N6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Dic").Select
Range("AB4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("liste").Select
Range("H9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
Sheets("Dic").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Gen").Select
Range("C7").Select
'
'Fine copia saldi
'
'>>>>>>>>>>>>>>>>>>>>>>>>>>> Cancella i dati dei mesi Gen-Feb-Mar-Apr
ActiveSheet.Unprotect
Sheets("Feb").Select
ActiveSheet.Unprotect
Sheets("Mar").Select
ActiveSheet.Unprotect
Sheets("Apr").Select
ActiveSheet.Unprotect
Sheets("Mag").Select
ActiveSheet.Unprotect
Sheets("Giu").Select
ActiveSheet.Unprotect
Sheets("Lug").Select
ActiveSheet.Unprotect
Sheets("Ago").Select
ActiveSheet.Unprotect
Sheets("Set").Select
ActiveSheet.Unprotect
Sheets("Ott").Select
ActiveSheet.Unprotect
Sheets("Nov").Select
ActiveSheet.Unprotect
Sheets("Dic").Select
ActiveSheet.Unprotect
Sheets(Array("Gen", "Feb", "Mar", "Apr")).Select
Sheets("Gen").Activate
Range("B7:D275").Select
Selection.ClearContents
Range("G7:G275").Select
Selection.ClearContents
Sheets("Gen").Activate
Range("B7").Select
'
'<<<<<<<<< Riporta le scadenze da Dic , nei mesi Gen,Feb,Mar,Apr
'
Dim I As Long, deSh As String, NextR As Long
Sheets("Dic").Select '<<<<<<<<<<< Il foglio di partenza
For I = 1 To Cells(Rows.Count, "B").End(xlUp).Row
If IsDate(Cells(I, "B").Value) Then
deSh = Format(Cells(I, "B"), "mmm")
NextR = Sheets(deSh).Cells(Rows.Count, "B").End(xlUp).Row + 1 '**
Cells(I, 2).Resize(1, 6).Copy Sheets(deSh).Cells(NextR, "B") '**
End If
Next I
'
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<Fine Copia scadenze
'
'>>>>>>>>>>>>>>>>>>>>>>>>>>> Cancella i dati dei mesi Mag-Giu.Lug-Ago-Set-Ott-Nov-Dic
'
Sheets(Array("Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", _
"Dic")).Select
Sheets("Mag").Activate
Range("B7:D275").Select
Selection.ClearContents
Range("G7:G275").Select
Selection.ClearContents
Sheets("Gen").Activate
Range("B7").Select
'
'<<<<<<<<<<<<<<<<<<<< Inizio Protezione fogli
'
Sheets("Gen").Select
Range("C7").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Feb").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Mar").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Apr").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Mag").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Giu").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Lug").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Ago").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Set").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Ott").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Nov").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Dic").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Gen").Select
Range("C7").Select
'
'<<<<<<<<<<<<<<<<< Fine protezione fogli
'
MsgBox "Salvataggio Dati Andato a buon Fine ..Buon Inizio Anno"
'Unload UserForm1
Exit Sub
Application.ScreenUpdating = True
'
'ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
' ActiveWorkbook.Save
'
End Sub
Sheets("Dic").Select '<<<<<<<<<<< Il foglio di partenza
Stop
For I = 1 To Cells(Rows.Count, "B").End(xlUp).Row
If IsDate(Cells(I, "B").Value) Then
deSh = Format(Cells(I, "B"), "mmmm")
NextR = Sheets(deSh).Cells(Rows.Count, "B").End(xlUp).Row + 1 '**
Debug.Print I, Cells(I, "B"), deSh, NextR
Cells(I, 2).Resize(1, 6).Copy Sheets(deSh).Cells(NextR, "B") '**
End If
Next I
Stop
If IsDate(Cells(I, "B").Value) Then
deSh = Format(Cells(I, "B"), "mmm")
If Ucase(deSh) <> "DIC" Then
NextR = Sheets(deSh).Cells(Rows.Count, "B").End(xlUp).Row + 1 '**
Debug.Print I, Cells(I, "B"), deSh, NextR
Cells(I, 2).Resize(1, 6).Copy Sheets(deSh).Cells(NextR, "B") '**
End If
End If
Torna a Applicazioni Office Windows
Inserimento parziale valore cella in MessageBox Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 6 |
Come evidenziare aree separate di un foglio Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 18 |
Inserire dati filtrati da 2 file ad un terzo file Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 14 |
Supporto per sviluppo macro VBA Ordinare per data Autore: Carletto Ribolla |
Forum: Applicazioni Office Windows Risposte: 3 |
Visitano il forum: Nessuno e 63 ospiti