Moderatori: Anthony47, Flash30005
Da quanto dici dopo deduco che "è esatto" l'hai dato sulla fiducia... Ma io avevo chiesto se l'importazione era da fare in Anagrafica, mentre ora capisco che e' da fare in Movimenti.Danibi ha scritto:Si è esatto, giusto per farti un esempio oggi il cliente me ne ha girato un altro che ti allego e nel quale mi evidenzia in rosa quanto mi ha affidato oggi da mettere in magazzino
Sub ImportaPIT()
Dim PIT As Workbook
Dim ExpA(), EInd As Long
Dim bgCol As Long, I As Long, J As Long
Dim dbrRows As Long, frRows As Long
bgCol = Selection.Cells(1, 1).Interior.Color
If bgCol = xlNone Or bgCol = RGB(255, 255, 255) Then
MsgBox ("Seleziona una cella colorata e riprova")
Exit Sub
End If
Set PIT = ActiveWorkbook
ReDim ExpA(1 To ActiveSheet.UsedRange.Rows.Count, 1 To 4)
For I = 2 To UBound(ExpA)
If Cells(I, 1).Interior.Color = bgCol Then
If Cells(I, 1) <> "" Then
EInd = EInd + 1
For J = 1 To 4
ExpA(EInd, J) = Cells(I, J).Value
Next J
End If
End If
Next I
'Array ready, make space in Table:
ThisWorkbook.Activate
Sheets("Movimenti").Select
With ActiveSheet.ListObjects("Movimenti")
dbrRows = .DataBodyRange.Rows.Count
frRows = dbrRows - Application.WorksheetFunction.CountA(.ListColumns(2).DataBodyRange)
For I = 1 To (EInd - frRows + 5)
.ListRows.Add AlwaysInsert:=False
Next I
icopy = .DataBodyRange.Cells(dbrRows, 2).End(xlUp).Row + 1
End With
Cells(icopy, 2).Resize(EInd, 4).Value = ExpA
''PIT.Close False
End Sub
Su quale foglio devo guardare e che cosa sono gli "intervalli" che devo cercare?Se noti (nel file che ti allego) da riga 34 a riga 88 così come da riga 150 a 159 ci sono degli intervalli [...]
Sub ImportaPIT()
Dim PIT As Workbook
Dim ExpA(), EInd As Long
Dim bgCol As Long, I As Long, J As Long
Dim dbrRows As Long, frRows As Long
Dim PRE As String 'MMMM
bgCol = Selection.Cells(1, 1).Interior.Color
If bgCol = xlNone Or bgCol = RGB(255, 255, 255) Then
MsgBox ("Seleziona una cella colorata e riprova")
Exit Sub
End If
Set PIT = ActiveWorkbook
ReDim ExpA(1 To ActiveSheet.UsedRange.Rows.Count, 1 To 5) 'MMMM
For I = 2 To UBound(ExpA)
If Cells(I, 1).Interior.Color = bgCol Then
If Cells(I, 1) <> "" Then
If Cells(I, 4) <> "" Then 'AAAA
EInd = EInd + 1 'MMMM / AAAA
For J = 1 To 4
If J < 3 Then PRE = "'" Else PRE = ""
ExpA(EInd, J) = PRE & Cells(I, J).Value
Next J
ExpA(EInd, 5) = 1
Else
ExpA(EInd, 1) = ExpA(EInd, 1) & " - " & Cells(I, 1)
ExpA(EInd, 2) = ExpA(EInd, 2) & " - " & Cells(I, 2)
ExpA(EInd, 3) = ExpA(EInd, 3) + Cells(I, 3)
End If
End If
End If
Next I
'Array ready, make space in Table:
ThisWorkbook.Activate
Sheets("Movimenti").Select
With ActiveSheet.ListObjects("Movimenti")
dbrRows = .DataBodyRange.Rows.Count
frRows = dbrRows - Application.WorksheetFunction.CountA(.ListColumns(2).DataBodyRange)
For I = 1 To (EInd - frRows + 5)
.ListRows.Add AlwaysInsert:=False
Next I
icopy = .DataBodyRange.Cells(dbrRows, 2).End(xlUp).Row + 1
End With
Cells(icopy, 2).Resize(EInd, 5).Value = ExpA 'MMMM
''PIT.Close False
End Sub
danibi ha scritto:Mi spieghi un pochino meglio cosa intendi con questi passaggi:in caso di errore la cancellazione del dato inserito per sbaglio deve seguire questa sequenza:
prima cancellare la colonna Uscita e poi Data U, in caso per errore facessi il contrario che succederebbe?
danibi ha scritto:Anthony ha scritto:Ci sono dei controlli che in qualche situazione potrebbero impedirti di fare una cosa che devi proprio fare; in questo caso compilando la cella Q1 col valore 123 il controllo sara’ disabilitato per la prossima modifica e subito ripristinata.
quando dovrei inserire 123 in Q1?
=CONTA.PIÙ.SE(Movimenti[Data];">="&A26;Movimenti[Data];"<"&A27)
=CONTA.PIÙ.SE(Movimenti[Data U];">="&A26;Movimenti[Data U];"<"&A27)
=SOMMA.SE(Movimenti[Data];"<="&FINE.MESE(A26;0);Movimenti[Q.tà Bancale])-SOMMA.SE(Movimenti[Data U];"<"&A26;Movimenti[Q.tà Bancale])
=DATA.MESE(A26;1)
=D26+B27-C26
Torna a Applicazioni Office Windows
Visitano il forum: Nessuno e 5 ospiti