Hello Sir,
I try to create simple stock control for my gas cylinder in my work to control stock IN and OUT.
I will always input the number of gas cylinders in column E(LAB1) and column F(LAB2) by massage box.
when Positive value = stock in, Negative value = stock out
The program should be finding current month to add stock IN and OUT after place OK in massage box
Example1 : Stock in LAB1 at Jul
When Active Cell = E5
If I input 5 in text box, 5 should go in E5 by ActiveCell.Value = ActiveCell.Value + 5.
At current month (Jul-Column T) 5 value should go in the cell T5 of July by ActiveCell.Value = ActiveCell.Value + 5.also.
Expected result
Example2 : Stock out LAB2 at Jul
When Active Cell = F6
If I input -2 in text box, -2 should go in U6 by ActiveCell.Value = ActiveCell.Value + (-2).
At current month (Jul-Column U) -2 value should go in the cell U6 of July by ActiveCell.Value = ActiveCell.Value + (-2).also.
Expected result
Example3 : Stock out LAB1 at Aug
When Active Cell = E5
If I input -1 in text box, -1 should go in E5 by ActiveCell.Value = ActiveCell.Value + (-1).
At current month (Aug-Column W) -1 value should go in the cell W5 of Aug by ActiveCell.Value = ActiveCell.Value + (-1).also.
Expected result
If you require more information, please let me know.
Thanks!
I try to create simple stock control for my gas cylinder in my work to control stock IN and OUT.
VBA Code:
Sub addStock()
Dim balanceStock As Double
Dim Col As Integer
'Check imput Applies columns E & F only ??
If ActiveCell.Column < 5 Or ActiveCell.Column > 6 Then Exit Sub
Col = Month(Now) + 12
balanceStock = InputBox("Amount?")
With ActiveCell
.Value = .Value + balanceStock
If balanceStock < 0 Then Col = Col + 1
Cells(.Row, Col) = Cells(.Row, Col) + balanceStock
End With
End Sub
I will always input the number of gas cylinders in column E(LAB1) and column F(LAB2) by massage box.
when Positive value = stock in, Negative value = stock out
The program should be finding current month to add stock IN and OUT after place OK in massage box
Example1 : Stock in LAB1 at Jul
When Active Cell = E5
If I input 5 in text box, 5 should go in E5 by ActiveCell.Value = ActiveCell.Value + 5.
At current month (Jul-Column T) 5 value should go in the cell T5 of July by ActiveCell.Value = ActiveCell.Value + 5.also.
Expected result
Example2 : Stock out LAB2 at Jul
When Active Cell = F6
If I input -2 in text box, -2 should go in U6 by ActiveCell.Value = ActiveCell.Value + (-2).
At current month (Jul-Column U) -2 value should go in the cell U6 of July by ActiveCell.Value = ActiveCell.Value + (-2).also.
Expected result
Example3 : Stock out LAB1 at Aug
When Active Cell = E5
If I input -1 in text box, -1 should go in E5 by ActiveCell.Value = ActiveCell.Value + (-1).
At current month (Aug-Column W) -1 value should go in the cell W5 of Aug by ActiveCell.Value = ActiveCell.Value + (-1).also.
Expected result
If you require more information, please let me know.
Thanks!