I've designed a workbook that allows you to receive products on the first
receiving sheet and then it's going to add it to your inventory sheet and so
you can see that I have product a B and C here and that all of my numbers are
one and so when we press the receive stock button here it first of all
deletes all the stuff that we haven't received me because now it's being
placed in inventory and then let's go over to here and there you see we've
added products to all of the numbers and then product D was added and the and the
cost of that was added as well so let you let me show you how I did this so
the first thing i did was i declared values and so it's based on clicking
this button right and so then X as long receiving as a workbook inventory as a
workbook product number as a string enroll is long RNG is a range
rownumber as long and row as long so x equals two because we have heading rows
on the top ones while sells x one which is the first column does not equals
blank then you you go through this so we're setting our product number equals
to the cell in the x row in the first column
so for each with the worksheet on inventory which is where we're going to
put it it's going to search the product number set string range is the range is
what we're looking for is if we're going to look for the product number in these
cells and we're looking in range a a so that's all of a we're looking for
product numbers now so if they find if they find range is nothing if they don't
find the product number on the sheet then we're going to set the end row and
the end Row equals worksheets inventory cells
one one current region count one so it's going to count to the end row and then
it's gonna go to the next one and so then it's gonna copy to inventory cells
the receiving cell so in row 1 the first column is equal to receiving sheets x1
and then inventory in row 2 2 the second column equals 2 or the receiving sheet
x2 and the same thing with inventory in Row 3 equals receiving x' x3 and go to
end which is go to and II which is just before the loop here there we have ende
here okay else if they find if the row number or range has found row number
equals the range that row number was found on and so with after the end if
and the end with worksheets inventory cells row number 2 value equals
worksheets inventory sells row number plus the worksheets receiving cells x2
value so it's adding those two values together and then we we increase our
loop now after we've got all this done and we've got all our inventory in place
then we go through we go back to the receiving sheet and in I changed it from
X to row so that we wouldn't get confused and so do-while Row one does
not equals blank and range sells Row one column one to row column three select so
that's all the values that I have in there and I say selection delete now
because we're deleting these rows you don't need to add one to the row number
and then you loop and you do it all over again so let me run this again I'll put
some more values in there so you can see it runs so I've added some more
information too my receiving sheet I've got product a
and product being that I'm adding for to and I've added a new product II so if we
go to our inventory for a second we notice that we have a and B we have four
and we have no product e here so let's press our receive stock button here and
then we'll go and see so now we have eight and eight for product a and B
which is perfect we have no change in product C and D and we have product E as
it's supposed to be so that's how you create a receiving sheet that's adds
products to your inventory please subscribe
Không có nhận xét nào:
Đăng nhận xét