Professional Documents
Culture Documents
00:00 39:28
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 1/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
Sub showAddSupplierForm()
frmSupplier.Show
End Sub
Sub viewStock()
frmStock.Show
End Sub
Sub addCustomers()
frmCustomer.Show
End Sub
Sub addPurchases()
frmPurchases.Show
End Sub
Sub addSales()
frmSales.Show
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 2/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
End Sub
If chkO er Then
Sheet3.Cells(erow, 11) = “Yes”
Else
Sheet3.Cells(erow, 11) = “No”
End If
End Sub
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 3/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
Next ctl
End Sub
lastrow = Sheet7.Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
erow = lastrow + 1
If ComboBox1.Value = “” Then
MsgBox “Select a supplier!”
ComboBox1.SetFocus
Exit Sub
End If
Sheet7.Cells(erow, 1) = Me.ComboBox1.Value
Sheet7.Cells(erow, 2) = Me.TextBox1
Sheet7.Cells(erow, 3) = Me.TextBox2
Sheet7.Cells(erow, 4) = Me.ComboBox2
Sheet7.Cells(erow, 5) = Me.TextBox3.Value
Sheet7.Cells(erow, 6) = Me.TextBox4.Value
Sheet7.Cells(erow, 7) = Me.TextBox3.Value * Me.TextBox4.Value
erow = erow + 1
Sheet7.Cells(erow, 4) = Me.ComboBox3.Value
Sheet7.Cells(erow, 5) = Me.TextBox5.Value
Sheet7.Cells(erow, 6) = Me.TextBox6.Value
Sheet7.Cells(erow, 7) = Me.TextBox5.Value * Me.TextBox6.Value
erow = erow + 1
Sheet7.Cells(erow, 4) = Me.ComboBox4.Value
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 4/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
Sheet7.Cells(erow, 5) = Me.TextBox7.Value
Sheet7.Cells(erow, 6) = Me.TextBox8.Value
Sheet7.Cells(erow, 7) = Me.TextBox7.Value * Me.TextBox8.Value
erow = erow + 1
Sheet7.Cells(erow, 4) = Me.ComboBox5.Value
Sheet7.Cells(erow, 5) = Me.TextBox9.Value
Sheet7.Cells(erow, 6) = Me.TextBox10.Value
Sheet7.Cells(erow, 7) = Me.TextBox9.Value * Me.TextBox10.Value
erow = erow + 1
Sheet7.Cells(erow, 4) = Me.ComboBox6.Value
Sheet7.Cells(erow, 5) = Me.TextBox11.Value
Sheet7.Cells(erow, 6) = Me.TextBox12.Value
Sheet7.Cells(erow, 7) = Me.TextBox11.Value * Me.TextBox12.Value
End Sub
End Sub
Sheet2.Select
lastrowf = Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 5/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
For i = 2 To lastrowf
Me.ComboBox1.AddItem Sheet2.Cells(i, “A”).Value
Next i
Sheet7.Select
lastrowf = Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
For i = 2 To lastrowf
For x = 2 To 6
Me.Controls(“Combobox” & x).AddItem Sheet7.Cells(i, 4).Value
Next x
Next i
End Sub
End Sub
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 6/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
lastrow = Sheet6.Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
erow = lastrow + 1
If ComboBox1.Value = “” Then
MsgBox “Select a customer!”
ComboBox1.SetFocus
Exit Sub
End If
Sheet6.Cells(erow, 1) = Me.ComboBox1.Value
Sheet6.Cells(erow, 2) = Me.TextBox1
Sheet6.Cells(erow, 3) = Me.TextBox2
Sheet6.Cells(erow, 4) = Me.ComboBox2.Value
Sheet6.Cells(erow, 5) = Me.TextBox3.Value
Sheet6.Cells(erow, 6) = Me.TextBox4.Value
Sheet6.Cells(erow, 7) = Me.TextBox3.Value * Me.TextBox4.Value
erow = erow + 1
Sheet6.Cells(erow, 4) = Me.ComboBox3.Value
Sheet6.Cells(erow, 5) = Me.TextBox5.Value
Sheet6.Cells(erow, 6) = Me.TextBox6.Value
Sheet6.Cells(erow, 7) = Me.TextBox5.Value * Me.TextBox6.Value
erow = erow + 1
Sheet6.Cells(erow, 4) = Me.ComboBox4.Value
Sheet6.Cells(erow, 5) = Me.TextBox7.Value
Sheet6.Cells(erow, 6) = Me.TextBox8.Value
Sheet6.Cells(erow, 7) = Me.TextBox7.Value * Me.TextBox8.Value
erow = erow + 1
Sheet6.Cells(erow, 4) = Me.ComboBox5.Value
Sheet6.Cells(erow, 5) = Me.TextBox9.Value
Sheet6.Cells(erow, 6) = Me.TextBox10.Value
Sheet6.Cells(erow, 7) = Me.TextBox9.Value * Me.TextBox10.Value
erow = erow + 1
Sheet6.Cells(erow, 4) = Me.ComboBox6.Value
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 7/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
Sheet6.Cells(erow, 5) = Me.TextBox11.Value
Sheet6.Cells(erow, 6) = Me.TextBox12.Value
Sheet6.Cells(erow, 7) = Me.TextBox11.Value * Me.TextBox12.Value
End Sub
lastrow = Sheet3.Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
For i = 2 To lastrow
Me.ComboBox1.AddItem Sheet3.Cells(i, “A”).Value
Next i
Sheet6.Select
lastrow = Sheet6.Range(“B” & Rows.Count).End(xlUp).Row
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 8/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
TextBox1.Value = Cells(lastrow, 2)
TextBox1.Value = TextBox1.Value + 1
For i = 2 To lastrowf
Me.ComboBox1.AddItem Sheet2.Cells(i, “A”).Value
Next i
Sheet7.Select
lastrowf = Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
For i = 2 To lastrowf
For x = 2 To 6
Me.Controls(“Combobox” & x).AddItem Sheet7.Cells(i, 4).Value
Next x
Next i
End Sub
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 9/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
Next ctl
End Sub
Sheet7.Select
lastrow = Sheet7.Cells.Find(What:=”*”, _
After:=Range(“A1″), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
totalqtypurchased = o
For i = 2 To lastrow
If Sheet7.Cells(i, 4) = ComboBox2.Value Then
TextBox1.Value = Cells(i, 6).Value
totalqtypurchased = totalqtypurchased + Cells(i, 5).Value
End If
Next i
TextBox2.Value = totalqtypurchased
Sheet6.Select
lastrow = Sheet6.Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
totalqtysold = o
For i = 2 To lastrow
If Sheet6.Cells(i, 4) = ComboBox2.Value Then
TextBox3.Value = Cells(i, 6).Value
totalqtysold = totalqtysold + Cells(i, 5).Value
End If
Next i
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 10/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
TextBox4.Value = totalqtysold
End Sub
erow = lastrow + 1
Sheet4.Cells(erow, 1) = ComboBox1.Value
Sheet4.Cells(erow, 2) = ComboBox2.Value
Sheet4.Cells(erow, 3) = TextBox1.Value
Sheet4.Cells(erow, 4) = TextBox2.Value
Sheet4.Cells(erow, 5) = TextBox3.Value
Sheet4.Cells(erow, 6) = TextBox4.Value
Sheet4.Cells(erow, 7) = TextBox5.Value
Sheet4.Cells(erow, 8) = TextBox6.Value
End Sub
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 11/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
lastrow = Sheet2.Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
For i = 2 To lastrow
Me.ComboBox1.AddItem Sheet2.Cells(i, “A”).Value
Next i
Sheet7.Select
lastrow = Sheet7.Cells.Find(What:=”*”, _
After:=Range(“A1”), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
For x = 2 To 6
End Sub
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 12/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
For i = 1 To 9
If Me.Controls(“TextBox” & i) = “” Then
MsgBox “All data in the user-form must be entered!”
Controls(“TextBox” & i).SetFocus
Exit Sub
End If
Next i
End Sub
End Sub
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 13/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
UserInterface
This entry was posted in Excel VBA 2013 and tagged automated inventory management, inventory
management with userforms on November 24, 2017 [https://www.exceltrainingvideos.com/inventory-
management-with-userforms/] .
punnlok
December 8, 2017 at 3:21 am
afqhrstm
January 2, 2018 at 8:10 am
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 14/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
Kaushik Majumder
December 13, 2017 at 12:13 pm
Dear Sir
Alam Khan
December 30, 2017 at 10:09 am
download software
SUBRAMANIYAN
January 3, 2018 at 10:48 am
Debasish Dash
January 16, 2018 at 11:03 am
SIR,
I need little help from you if i know your email id i can drop you my problem in your inbox
thank you
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 15/16
1/21/2018 Inventory Management with UserForms | Excel VBA Training Online
https://www.exceltrainingvideos.com/inventory-management-with-userforms/ 16/16