Sub Carico5() 'Pulsante per il Carico del prodotto
On Error GoTo SALTA
Application.ScreenUpdating = False
Dim Fg1 As foglio1
Dim Rg As range
Dim Rg1 As range
Dim Rg2 As range
Dim Rg3 As range
Dim Rg4 As range
Dim rg5 As range
Set Fg1 = foglio1
Set Rg = Fg1.range("AB5:AC5")
Set Rg1 = Fg1.range("J5:K5")
Set Rg2 = Fg1.range("F5")
Set Rg3 = Fg1.range("H5")
Set Rg4 = Fg1.range("E5")
Set rg5 = Fg1.range("A5")
Dim Message, Title, Default, MyValue
Message = ("Immettere la quantità di CARICO del prodotto " + foglio1.range("A5"))
Title = (rg5)
Default = "1"
MyValue = InputBox(Message, Title, Default)
Rg1.Copy
Rg.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rg1.ClearContents
Rg2 = range("H5").Value + MyValue
SALTA:
Rg.Select
Application.CutCopyMode = False
Rg.Select
Selection.Copy
Rg1.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Rg.ClearContents
Rg4.Select
Application.ScreenUpdating = True
End Sub
Sub Scarico5() 'Pulsante per lo Scarico del prodotto
On Error GoTo SALTA
Dim Fg1 As foglio1
Dim Srg, Srg1, Srg2, Srg3, Srg4 As range
Set Fg1 = foglio1
Set Srg = Fg1.range("AD5:AE5")
Set Srg1 = Fg1.range("J5:K5")
Set Srg2 = Fg1.range("A5")
Set Srg3 = Fg1.range("E5")
Set Srg4 = range("AD5")
Application.ScreenUpdating = False
Dim Message, Title, Default, MyValue
Message = ("Immettere la quantità di SCARICO del prodotto " + foglio1.range("A5"))
Title = (Srg2)
Default = "1"
MyValue = InputBox(Message, Title, Default)
Srg1.Copy
Srg.Select
Srg.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Srg1.ClearContents
Worksheets("Foglio1").range("J5") = Srg4.Value + MyValue
Srg4.Select
Selection.ClearContents
Srg3.Select
GoTo ok
SALTA:
Srg.Copy
Srg1.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ok:
Srg3.Select
Application.ScreenUpdating = True
End Sub
Sub Reset5() 'Pulsante per il Reset
Dim Msg, Style, Title, Response, MyString
Msg = "Eliminare i record di Carico e Scarico " + foglio1.range("A5") + " ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = foglio1.range("A5")
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then
MyString = "Sì"
GoTo ok
Else
MyString = "No"
GoTo esco
End If
ok:
range("F5,J5").Select
Selection.ClearContents
range("E5").Select
esco:
range("E5").Select
End Sub |