Receive products and add to inventory in Excel



Receive products and add to inventory in Excel
Search the product numbers that already exists if found and number to inventory. If the product is not found, add the new product to inventory. Delete the products that have been added to inventory.
code
Sub Button1_Click()

Dim x As Long
Dim recieving As Worksheet
Dim inventory As Worksheet
Dim productn As String
Dim erow As Long
Dim rng As Range
Dim rownumber As Long
Dim row As Long

x = 2
Do While Cells(x, 1) (not equal symbol) “”

‘ go through each item on list
productn = Cells(x, 1)

‘ if item is not new then add quanity to total inventory
With Worksheets(“inventory”).Range(“A:A”)
Set rng = .Find(What:=productn, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

‘if item is new add item to the bottom of inventory list

If rng Is Nothing Then
erow = Worksheets(“inventory”).Cells(1, 1).CurrentRegion.Rows.Count + 1
Worksheets(“inventory”).Cells(erow, 1) = Worksheets(“receiving”).Cells(x, 1)
Worksheets(“inventory”).Cells(erow, 2) = Worksheets(“receiving”).Cells(x, 2)
Worksheets(“inventory”).Cells(erow, 3) = Worksheets(“receiving”).Cells(x, 3)
GoTo ende
Else
rownumber = rng.row

End If
End With

Worksheets(“inventory”).Cells(rownumber, 2).Value = Worksheets(“inventory”).Cells(rownumber, 2).Value _
+ Worksheets(“receiving”).Cells(x, 2).Value

ende:
x = x + 1

Loop

‘after complete delete items from receiving list

Worksheets(“receiving”).Select
row = 2
Do While Cells(row, 1) (not equal symbol) “”
Range(Cells(row, 1), Cells(row, 3)).Select
Selection.Delete

Loop

End Sub

For more help visit my website or email me at easyexcelanswers@gmail.com.

Contact me regarding customizing this template for your needs.

Excel one-on-one on-line training available. Email me to arrange.

I am able to provide online help on your computer at a reasonable rate.

Check out my next one-hour Excel Webinar

I use a Blue condensor Microphone to record my videos, here is the link

Check out Crowdcast for creating your webinars

If you need to buy Office 2019 follow

I use Tube Buddy to help promote my videos
Check them out

Follow me on Facebook

Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language

*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.

Watch more new videos about Excel Office | Synthesized by Mindovermetal English

Rate this post

Bài viết liên quan

Theo dõi
Thông báo của
guest
2 Comments
Cũ nhất
Mới nhất Được bỏ phiếu nhiều nhất
Phản hồi nội tuyến
Xem tất cả bình luận
Barb Henderson

Thank you so much for watching my video. I have the code in the description of the video but please not I am not able to include square brackets. There for >, <>, and < symbols have been replaced with text. Please check for these before you try to run the code.

Agustin Barcia

You did help me so much. Thank you