ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   stock control (https://www.excelbanter.com/excel-programming/290312-stock-control.html)

stiv

stock control
 
I have an inventory list online that is constantly updated. What I'm
looking to do is check and see which products are out of stock and
which have been added into stock this process happens twice a week. To
figure this out maybe would be a macro that could look at Column C
(items stock level) look and see any item with a 0 (out of stock) would
then take the mfr code (ex. ACO-AP1650) in column A and list it in
column B the products that are out of stock.

Column A ............ Column B.........Column C

ACO-AP1650.....................................5
FIS-43REJ............FIS-43REJ.............0
SAN-G34DD......................................2

Thank you for your time,

Greg


---
Message posted from http://www.ExcelForum.com/


acw[_2_]

stock control
 
Greg

the following macro will give you what you want. However, why don't you just fill column B with a formula. Put the following in B2 and copy down as required.
Formula
=IF(C2,"",A2)

Macro
Sub aaa()
Range("c2").Select
While Not IsEmpty(ActiveCell)
If ActiveCell = 0 Then
ActiveCell.Offset(0, -1) = ActiveCell.Offset(0, -2)
Else
ActiveCell.Offset(0, -1) = ""
End If
ActiveCell.Offset(1, 0).Select
Wend
End Sub


Tony



----- stiv wrote: -----

I have an inventory list online that is constantly updated. What I'm
looking to do is check and see which products are out of stock and
which have been added into stock this process happens twice a week. To
figure this out maybe would be a macro that could look at Column C
(items stock level) look and see any item with a 0 (out of stock) would
then take the mfr code (ex. ACO-AP1650) in column A and list it in
column B the products that are out of stock.

Column A ............ Column B.........Column C

ACO-AP1650.....................................5
FIS-43REJ............FIS-43REJ.............0
SAN-G34DD......................................2

Thank you for your time,

Greg


---
Message posted from http://www.ExcelForum.com/



Jim Feaver

stock control
 
Hi Greg:
You can call it from Sheet1's Worksheet_Change event procedure.

'example of calling from the event proedure
Private Sub Worksheet_Change(ByVal Target As Range)
CheckStock
End Sub

'place in a standard module
Sub CheckStock()
Dim lLastRow As Long, i As Integer
Dim Sh1 As Worksheet

Set Sh1 = ThisWorkbook.Worksheets("Sheet1")

lLastRow = Sh1.Cells(Rows.Count, "A").End(xlUp).Row

Application.EnableEvents = False
For i = 1 To lLastRow
If Sh1.Range("A1").Offset(i, 2).Value = 0 Then
Sh1.Range("A1").Offset(i, 1).Value = _
Sh1.Range("A1").Offset(i, 0).Value
Else
Sh1.Range("A1").Offset(i, 1).Value = ""
End If
Next i
Application.EnableEvents = True

Set Sh1 = Nothing

End Sub

Regards,
Jim Feaver

"stiv " wrote in message
...
I have an inventory list online that is constantly updated. What I'm
looking to do is check and see which products are out of stock and
which have been added into stock this process happens twice a week. To
figure this out maybe would be a macro that could look at Column C
(items stock level) look and see any item with a 0 (out of stock) would
then take the mfr code (ex. ACO-AP1650) in column A and list it in
column B the products that are out of stock.

Column A ............ Column B.........Column C

ACO-AP1650.....................................5
FIS-43REJ............FIS-43REJ.............0
SAN-G34DD......................................2

Thank you for your time,

Greg


---
Message posted from http://www.ExcelForum.com/




stiv

stock control
 
Thank you, Tony and Jim for your help make my job easier.

Gre

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 06:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com