
Sub archiviaDati()
'
' archiviaDati Macro
'
'
Range("K3,N3").Select
Selection.Copy
Sheets("Foglio2").Select
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 2).Range("A1").Select
Sheets("Foglio1").Select
Range("B6:B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Foglio2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
ActiveCell.Offset(0, 2).Range("A1").Select
Sheets("Foglio1").Select
Range("B9:C9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Foglio2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F10").Select
ActiveCell.Offset(0, 1).Range("A1").Select
End Sub |
Sub m()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim a As Range
Dim righe As Long
Dim c As Long
Set sh1 = Sheets("foglio1")
Set sh2 = Sheets("foglio2")
With sh1
Set a = .Range("b9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
.Cells(3, 11).Copy sh2.Cells(c, 1)
.Cells(3, 14).Copy sh2.Cells(c, 2)
.Cells(6, 2).Copy sh2.Cells(c, 3)
.Cells(7, 2).Copy sh2.Cells(c, 4)
.Cells(c + 8, 2).Resize(, 2).Copy sh2.Cells(c, 5)
Next
End With
End Sub
|
Sub m()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim a As Range
Dim righe As Long
Dim c As Long
Dim ultima As Long
Set sh1 = Sheets("foglio1")
Set sh2 = Sheets("foglio4")
Application.ScreenUpdating = False
With sh1
Set a = .Range("b9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 2).Copy
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 2).Copy
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 2).Resize(, 2).Copy
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
Set a = .Range("E9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
.Cells(3, 11).Copy
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 5).Copy
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 5).Copy
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 5).Resize(, 2).Copy
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End With
Application.ScreenUpdating = True
End Sub
|
Sub salva()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim a As Range
Dim righe As Long
Dim c As Long
Dim ultima As Long
Set sh1 = Sheets("foglio1")
Set sh2 = Sheets("foglio2")
Application.ScreenUpdating = False
With sh1
Set a = .Range("b9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 2).Copy 'ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 2).Copy ' autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 2).Resize(, 2).Copy ' n. pallette
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
Set a = .Range("E9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1 < |
Sub m()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim a As Range
Dim righe As Long
Dim c As Long
Dim ultima As Long
Set sh1 = Sheets("foglio1")
Set sh2 = Sheets("foglio2")
Application.ScreenUpdating = False
With sh1
Set a = .Range("b9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 2).Copy 'ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 2).Copy ' autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 2).Resize(, 2).Copy ' n. pallette
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
Set a = .Range("E9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 5).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 5).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 5).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
MsgBox "COPIATO SU FOGLIO2"
End With
Application.ScreenUpdating = True
End Sub
Sub salva()
today = Now
today = Cells(3, 1) & "_" & Cells(3, 11) & " _ " & Format(Date, "dd") & "." & Format(Date, "mm") & "." & Format(Date, "yy") & "." & Format(Time, "hhmmss")
Nome = "C:UsersUtente.ASSERVICEDesktoparchivio RITIRI"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome & today & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:= _
True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("B6:B7,B9:C17,E6:E7,E9:F17,H6:H7,H9:I17,K6:K7,K9:L17,N6:N7,N9:O17,B21:o32") = c7 ' sicuro sino N39
Cells(3, 11) = Cells(3, 11) + 1 ' per aumentare Bordero
MsgBox "PDF creato/salvato"
Range("b6").Select
ActiveWorkbook.Save
Call PDF
End Sub
|
Sub m()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim a As Range
Dim righe As Long
Dim c As Long
Dim ultima As Long
Set sh1 = Sheets("foglio1")
Set sh2 = Sheets("foglio2")
Application.ScreenUpdating = False
With sh1
Set a = .Range("b9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 2).Copy 'ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 2).Copy ' autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 2).Resize(, 2).Copy ' n. pallette
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
Set a = .Range("E9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 5).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 5).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 5).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
'With sh1
Set a = .Range("H9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 8).Copy 'ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 8).Copy ' autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 8).Resize(, 2).Copy ' n. pallette
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
MsgBox "COPIATO SU FOGLIO2"
End With
Application.ScreenUpdating = True
Call pdf
End Sub
Sub pdf()
today = Now
today = Cells(3, 1) & "_" & Cells(3, 11) & " _ " & Format(Date, "dd") & "." & Format(Date, "mm") & "." & Format(Date, "yy") & "." & Format(Time, "hhmmss")
Nome = "C:UsershpDesktoparchivio RITIRI"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome & today & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:= _
True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("B6:B7,B9:C17,E6:E7,E9:F17,H6:H7,H9:I17,K6:K7,K9:L17,N6:N7,N9:O17,B21:o32") = c7 ' sicuro sino N39
Cells(3, 11) = Cells(3, 11) + 1 ' per aumentare Bordero
MsgBox "PDF creato/salvato"
Range("b6").Select
ActiveWorkbook.Save
End Sub |
Private Sub cmdSalva_Click()
'Sub m()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim a As Range
Dim righe As Long
Dim c As Long
Dim ultima As Long
Set sh1 = Sheets("foglio1")
Set sh2 = Sheets("foglio2")
Application.ScreenUpdating = False
With sh1
Set a = .Range("b9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 2).Copy 'ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 2).Copy ' autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 2).Resize(, 2).Copy ' n. pallette
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
'Next
If Range("E9") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("E9").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 5).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 5).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 5).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("h9") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("H9").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 8).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 8).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 8).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("K9") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("K9").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 11).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 11).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 11).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("N9") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("N9").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 14).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 14).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 14).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("B24") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("B24").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 2).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 2).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 2).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("E24") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("E24").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 5).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 5).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 5).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("H24") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("H24").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 8).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 8).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 8).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("K24") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("K24").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 11).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 11).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 11).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
If Range("N24") = "" Then
ultima = sc2 = ""
Else
Set a = .Range("N24").CurrentRegion
righe = a.Rows.Count
'For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 14).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 14).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 14).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
Next
MsgBox "COPIATO SU FOGLIO2"
End With
Application.ScreenUpdating = True
Call pdff
End Sub
Sub pdff()
today = Now
today = Cells(3, 1) & "_" & Cells(3, 11) & " _ " & Format(Date, "dd") & "." & Format(Date, "mm") & "." & Format(Date, "yy") & "." & Format(Time, "hhmmss")
Nome = "C:UsersUtente.ASSERVICEDesktoparchivio RITIRI"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome & today & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:= _
True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("B6:B7,B9:C17,E6:E7,E9:F17,H6:H7,H9:I17,K6:K7,K9:L17,N6:N7,N9:O17,B21:o32") = c7 ' sicuro sino N39
Cells(3, 11) = Cells(3, 11) + 1 ' per aumentare Bordero
MsgBox "PDF creato/salvato"
Range("b6").Select
ActiveWorkbook.Save
End Sub
|
Private Sub cmdSalva_Click()
'Sub m()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim a As Range
Dim righe As Long
Dim c As Long
Dim ultima As Long
Set sh1 = Sheets("foglio1")
Set sh2 = Sheets("foglio2")
Application.ScreenUpdating = False
With sh1
Set a = .Range("b9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 2).Copy 'ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 2).Copy ' autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 2).Resize(, 2).Copy ' n. pallette
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
If Len(.Range("E9").Value) <> 0 Then
Set a = .Range("E9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 5).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 5).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 5).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("H9").Value) <> 0 Then
Set a = .Range("H9").CurrentRegion
righe = a.Rows.Count
For c = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 8).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 8).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 8).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("K9").Value) <> 0 Then
Set a = .Range("K9").CurrentRegion
righe = a.Rows.Count
For t = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 11).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 11).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 11).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("N9").Value) <> 0 Then
Set a = .Range("N9").CurrentRegion
righe = a.Rows.Count
For q = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(6, 14).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(7, 14).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 8, 14).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("B24").Value) <> 0 Then
Set a = .Range("B24").CurrentRegion
righe = a.Rows.Count
For s = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 2).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 2).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 2).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("E24").Value) <> 0 Then
Set a = .Range("E24").CurrentRegion
righe = a.Rows.Count
For v = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 5).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 5).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 5).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("H24").Value) <> 0 Then
Set a = .Range("H24").CurrentRegion
righe = a.Rows.Count
For n = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 8).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 8).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 8).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("K24").Value) <> 0 Then
Set a = .Range("K24").CurrentRegion
righe = a.Rows.Count
For m = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 11).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 11).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 11).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
If Len(.Range("N24").Value) <> 0 Then
Set a = .Range("N24").CurrentRegion
righe = a.Rows.Count
For o = 1 To righe
ultima = sh2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(3, 11).Copy ' n. lista
sh2.Cells(ultima, 1).PasteSpecial xlPasteValues
.Cells(3, 14).Copy ' data
sh2.Cells(ultima, 2).PasteSpecial xlPasteValues
.Cells(21, 14).Copy ' ditta
sh2.Cells(ultima, 3).PasteSpecial xlPasteValues
.Cells(22, 14).Copy 'autista
sh2.Cells(ultima, 4).PasteSpecial xlPasteValues
.Cells(c + 23, 14).Resize(, 2).Copy ' n. palleta
sh2.Cells(ultima, 5).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Next
End If
MsgBox "COPIATO SU FOGLIO2"
End With
Application.ScreenUpdating = True
Call pdff
End Sub
Sub pdff()
today = Now
today = Cells(3, 1) & "_" & Cells(3, 11) & " _ " & Format(Date, "dd") & "." & Format(Date, "mm") & "." & Format(Date, "yy") & "." & Format(Time, "hhmmss")
Nome = "C:UsersUtente.ASSERVICEDesktoparchivio RITIRI"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome & today & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:= _
True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("B6:B7,B9:C17,E6:E7,E9:F17,H6:H7,H9:I17,K6:K7,K9:L17,N6:N7,N9:O17,B21:o32") = c7 ' sicuro sino N39
Cells(3, 11) = Cells(3, 11) + 1 ' per aumentare Bordero
MsgBox "PDF creato/salvato"
Range("b6").Select
ActiveWorkbook.Save
End Sub
|
