Sub COMPILAPIVOT2()
Sheets("PIVOT").Select
Sheets("PIVOT2").Visible = True
Sheets("PIVOT2").Select
'variabili
lotto = Val(DialogSheets("dialogo1").EditBoxes("Edit Box 11").Text)
ddt = Val(DialogSheets("dialogo1").EditBoxes("Edit Box 12").Text)
Data = DialogSheets("dialogo1").EditBoxes("Edit Box 13").Text
cliente = Val(DialogSheets("dialogo1").EditBoxes("Edit Box 17").Text)
tutto = "(Tutto)"
'copia da dialogo a pivot
Dim column As Range
Dim cell As Range
Dim strtest As String
'verifica presenza data nella colonna relativa
Set column = Sheets("DATI").Range("V:V")
Set cell = column.Find(DateValue(Data))
If cell Is Nothing Then
Sheets("pivot2").Range("B2") = tutto
Else
'If Data <> "" Then
strtest = Format(Data, "dd/mm/yyyy")
Sheets("pivot2").Range("B2") = Data
End If
'verifica presenza ddt nella colonna relativa
Set column = Sheets("DATI").Range("F:F")
Set cell = column.Find(ddt)
If cell Is Nothing Then
Sheets("pivot2").Range("B3") = tutto
Else
' If ddt <> "0" Then
Sheets("pivot2").Range("B3") = ddt
End If
'verifica presenza lotto nella colonna relativa
Set column = Sheets("DATI").Range("AE:AE")
Set cell = column.Find(lotto)
If cell Is Nothing Then
Sheets("pivot2").Range("B4") = tutto
Else
'If lotto <> "0" Then
Sheets("pivot2").Range("B4") = lotto
End If
'verifica presenza lotto nella colonna relativa
Set column = Sheets("DATI").Range("I:I")
Set cell = column.Find(cliente)
If cell Is Nothing Then
Sheets("pivot2").Range("B5") = tutto
Else
'If cliente <> "0" Then
Sheets("pivot2").Range("B5") = cliente
End If
End Sub
|