使用 Excel 制作小超市收银系统

时间:2024-10-28 17:57:04

1、打开 Excel 将商品信息输入到 Excel 中的 Sheet2 中

使用 Excel 制作小超市收银系统

2、在 Excel 的 Sheet1 中最上面放一个输入框,用于输入条码或者扫描条码

使用 Excel 制作小超市收银系统

3、在 Excel 的 Sheet1 中最上面放一个用于清零的按钮

使用 Excel 制作小超市收银系统

4、双击这个“清零”按钮,打开VBA编辑窗口将其中自动生成的如下2行Private Sub CommandButton1_Click烫喇霰嘴()End Sub换成输入如下的内容:Private Sub CommandButton1_Click() For i = 4 To 100 If Me.Cells(i, 1) Is Nothing Then Me.Cells(i, 2).Value = "" Me.Cells(i, 3).Value = "" Me.Cells(4, 2).Value = "合计" Me.Cells(4, 3).Value = 0# Exit For End If If Me.Cells(i, 1).Value = "" Then Me.Cells(i, 2).Value = "" Me.Cells(i, 3).Value = "" Me.Cells(4, 2).Value = "合计" Me.Cells(4, 3).Value = 0 Exit For End If Me.Cells(i, 1).Value = "" Me.Cells(i, 2).Value = "" Me.Cells(i, 3).Value = "" Next TextBox1.Text = "" Image1.Picture = NothingEnd SubPrivate Sub TextBox1_Change() If TextBox1.Text = "" Then Exit Sub End If For i = 1 To 100 If Sheet2.Cells(i, 1).Value = TextBox1.Text Then AddProd i TextBox1.Text = "" Exit For End If 'MsgBox (Sheet2.Cells(i, 1).Value) If Sheet2.Cells(i, 1) Is Nothing Then Exit For End If NextEnd SubPrivate Sub AddProd(ByVal index As Integer) For i = 4 To 100 If Me.Cells(i, 1) Is Nothing Then Me.Cells(i, 1).Value = TextBox1.Text Me.Cells(i, 2).Value = Sheet2.Cells(index, 2).Value Me.Cells(i, 3).Value = Sheet2.Cells(index, 3).Value Me.Cells(i + 1, 2).Value = "合计" Me.Cells(i + 1, 3).Value = "=sum(C4:C" & i & ")" Image1.Picture = LoadPicture(Sheet2.Cells(index, 4).Value) Exit For End If If Me.Cells(i, 1).Value = "" Then Me.Cells(i, 1).Value = TextBox1.Text Me.Cells(i, 2).Value = Sheet2.Cells(index, 2).Value Me.Cells(i, 3).Value = Sheet2.Cells(index, 3).Value Me.Cells(i + 1, 2).Value = "合计" Me.Cells(i + 1, 3).Value = "=sum(C4:C" & i & ")" Image1.Picture = LoadPicture(Sheet2.Cells(index, 4).Value) Exit For End If NextEnd Sub

5、返回 Ex罕铞泱殳cel选择“文件”菜单中的“关闭并返回到 Microsoft Excel(C) Atl+Q”或者按 Atl+Q 组合键返回 Excel。

使用 Excel 制作小超市收银系统

6、从设计模式退出开始收银点击“控件工具箱”中的设计模式图标(红色箭头所指),从设计模式退出,进入正常收银模式。可以开始收银乐。搞定!

使用 Excel 制作小超市收银系统
© 手抄报圈