
Sub compiladati()
Dim Data As String
Dim RData As Long
Dim m, a
Data = [D15] 'data odierna
For m = 7 To 1000
If Foglio12.Cells(m, "A") = Data Then
RData = m
Exit For
End If
Next m
For a = RData To RData + 1
If Foglio12.Cells(a, 5).Value = Foglio13.Cells(21, 3).Value Then
Foglio12.Cells(a, 8).Value = Foglio13.Cells(21, 4).Value
a = a + 1
Foglio12.Cells(a, 8).Value = Foglio13.Cells(22, 4).Value
End If
Next a
End Sub |
Sub compiladati()
Dim Data As String
Dim RData As Long
Dim m As Integer, a As Integer, v As Variant, flag As Boolean
Data = [D15] 'data odierna
For m = 7 To 1000
flag = False
For Each v In Array(Foglio3, Foglio4, Foglio5, Foglio6, Foglio7, Foglio8, Foglio9, Foglio10, Foglio12, Foglio16, Foglio17, Foglio18)
If v.Cells(m, "A") = Data Then
RData = m
flag = True
Exit For
End If
Next
If flag Then Exit For
Next m
For a = RData To RData + 1
If Foglio12.Cells(a, "E").Value = Foglio13.Cells(21, 3).Value Then
Foglio12.Cells(a, "H").Value = Foglio13.Cells(21, 4).Value
a = a + 1
Foglio12.Cells(a, "H").Value = Foglio13.Cells(22, 4).Value
End If
Next a
End Sub |
Sub compiladati()
Dim Data As String
Dim RData As Long
Dim m As Integer, a As Integer, v As Variant, flag As Boolean
Data = [D15] 'data odierna
For m = 7 To 1000
flag = False
For Each v In Array(Foglio3, Foglio4, Foglio5, Foglio6, Foglio7, Foglio8, Foglio9, Foglio10, Foglio12, Foglio16, Foglio17, Foglio18)
If v.Cells(m, "A") = Data Then
RData = m
flag = True
Exit For
End If
Next
If flag Then Exit For
Next m
For a = RData To RData + 1
If Cells(a, 5).Value = Foglio13.Cells(21, 3).Value Then
Cells(a, 8).Value = Foglio13.Cells(21, 4).Value
a = a + 1
Cells(a, 8).Value = Foglio13.Cells(22, 4).Value
End If
Next a
'If Foglio12.Cells(a, "E").Value = Foglio13.Cells(21, 3).Value Then
' Foglio12.Cells(a, "H").Value = Foglio13.Cells(21, 4).Value
' a = a + 1
' Foglio12.Cells(a, "H").Value = Foglio13.Cells(22, 4).Value
' End If
' Next a
End Sub
|
Sub Compiladata()
Dim Data As Date, MioMese(), MiaData As String
Dim sh As Worksheet
MioMese = Array("GENNAIO", "FEBBRAIO", "MARZO", "APRILE", "MAGGIO", "GIUGNO", _
"LUGLIO", "AGOSTO", "SETTEMBRE", "OTTOBRE", "NOVEMBRE", "DICEMBRE")
MiaData = MioMese(Month([d15]) - 1) & " " & Format([d15], "yy") 'costruisce la stringa del Mese Anno
On Error Resume Next
Set sh = Worksheets(MiaData) 'Questo è il foglio del mese che ci interessa
With sh.Cells.Columns(1).Find(what:=[d15]) 'trova la data nel foglio del mese
.Offset(, 7).Value = [d21] 'Scrive il corrispettivo a
.Offset(, 7).Offset(1).Value = [d22] 'Scrive il corrispettivo b
End With
If Err.Number <> 0 Then MsgBox "Dati non trovati. Controlla Foglio Mese e Data", vbCritical
End Sub
|
