Sto cercando di aggiungere una macro ad un file excel per la gestione magazzino.
dopo averlo "aggiustato", secondo le mie esigenze , ha funzionato un paio di volte eppoi ..nada.
Sub SottoScorta1()
'
Dim Intervallo As Range, CL As Range
Dim Riga
Riga = 3
Set Intervallo = Sheets("Gestione_Magazzino").Range(Cells(3, 9), Cells(3, 9).End(xlDown))
Application.ScreenUpdating = False
' ricerca e trascrizione degli articoli che scarseggiano
With Worksheets("sottoscorta")
.Range(.Cells(2, 1), .Cells(2, 4).End(xlDown)).ClearContents
Riga = 1
For Each CL In Intervallo
CL.Offset(0, -1).Select
If CL.Value > CL.Offset(0, -1).Value Then
CL.Select
Riga = Riga + 1
.Cells(Riga, 1) = CL.Offset(0, -7) 'ID
.Cells(Riga, 2) = CL.Offset(0, -6) 'Prodotto
.Cells(Riga, 3) = CL.Value * 2 ' per X volte il val.sottoscorta
.Cells(Riga, 4) = CL.Offset(0, -4) 'prezzo unitario
End If
Next
End With
' preparazione del foglio per la stampa
With Worksheets("sottoscorta").PageSetup
.CenterHorizontally = True
.PrintArea = "B3:E15"
'.PrintArea = Range("B3:E15")
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = False
.Zoom = 50
End With
'Worksheets("sottoscorta").PrintPreview
Application.ScreenUpdating = True
End Sub
In pratica dovrebbe verificare nel foglio 1 se ci sono valori col H(giacenza) inferiori a col I(sottoscorta) e riportarli nel foglio 2.
Come dicevo all'inizio, dopo un paio di prove positive, mi si "inchioda" sulla riga in grassetto..perche'?
Un grazie anticipato a chi vorra' darmi una mano.
Win XP pro, Office 2010