
{"id":1514,"date":"2021-03-17T03:55:26","date_gmt":"2021-03-16T19:55:26","guid":{"rendered":"https:\/\/indonesiangems.com\/blog\/?p=1514"},"modified":"2021-03-19T06:24:28","modified_gmt":"2021-03-18T22:24:28","slug":"excel-macro-purchase-sales-form-data-entry","status":"publish","type":"post","link":"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/","title":{"rendered":"Purchase\/Sales Form Macro Codes For Data Entry"},"content":{"rendered":"<p class=\"last-updated\">Last updated on March 19th, 2021 at 06:24 am<\/p>\n<!--more-->\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button is-style-outline is-style-outline--1\"><a class=\"wp-block-button__link\" href=\"https:\/\/indonesiangems.com\/blog\/macro-untuk-form-input-di-excel\/\">switch language to bahasa<\/a><\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This topic is the continuation of the <a href=\"https:\/\/indonesiangems.com\/blog\/purchase-sales-data-entry-form-in-excel-with-activex-controls\/\">&#8220;Purchase\/Sales Data Entry Form&#8221;<\/a> page. Here Mr. Adi will make a Purchase\/Sales Form <a href=\"https:\/\/docs.microsoft.com\/en-us\/office\/vba\/library-reference\/concepts\/getting-started-with-vba-in-office\" target=\"_blank\" rel=\"noreferrer noopener\">macro codes<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If my reader wants to directly jump to the test-run stage of the macro, please download the sample file in the second page of this topic.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><em>Macro to set the size and the position of ActiveX control<\/em>.<\/h5>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-01_excel-visal-basic-editor-menu.png\"><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"184\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-01_excel-visal-basic-editor-menu.png\" alt=\"\" class=\"wp-image-1301\"\/><\/a><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Still in the &#8220;CUSU&#8221; sheet and the Developer menu tab, if the Design Mode still active (orange color), please deactivate it by clicking it. And then click the Visual Basic button (in my Excel Application, the button is on the most left menu) to open the Visual Basic Editor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From the image below, we can see that in the VB Editor left pane, there are two small windows, the &#8220;Project &#8211; VBAProject&#8221; window and the &#8220;Properties &#8211; Sheet5&#8221; window on the left side of the Editor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the &#8220;Project &#8211; VBAProject&#8221; window, double click the &#8220;Sheet5 (CUSU)&#8221; to make sure that the module (on the right pane) to write the macro is &#8220;CUSU&#8221; module.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-02_macro-untuk-setting-activex-control.png\"><img decoding=\"async\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-02_macro-untuk-setting-activex-control.png\" alt=\"\" class=\"wp-image-938\"\/><\/a><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the macro codes below then paste them on the white blank module on the right pane. The result will look like the image above.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Dim rngItem         As Range\nDim cnt             As Integer\n\nSub SetActiveXControls()\n    Set patok = Range(\"zz1\")\n    With CU\n        .Height = patok.Height * 2 - 5\n        .Width = patok.Width\n        .Top = Range(\"h2\").Top - 3\n        .Left = Range(\"h2\").Left\n    End With\n    With SU\n        .Height = patok.Height * 2 - 5\n        .Width = patok.Width\n        .Top = Range(\"i2\").Top - 3\n        .Left = Range(\"i2\").Left\n    End With\n    With Item\n        .Height = patok.Height * 2 - 5\n        .Width = patok.Width\n        .Top = Range(\"j2\").Top - 3\n        .Left = Range(\"j2\").Left\n    End With\n    With Kas_Bon\n        .Height = patok.Height * 2 - 5\n        .Width = patok.Width * 3\n        .Top = Range(\"h4\").Top - 8\n        .Left = Range(\"h4\").Left\n    End With\n    With SearchBox\n        .Height = patok.Height + 5\n        .Width = patok.Width * 2\n        .Top = Range(\"i6\").Top - 4\n        .Left = Range(\"i6\").Left\n    End With\n    With ListName\n        .Height = patok.Height * 6 - 2\n        .Width = patok.Width * 3\n        .Top = Range(\"h7\").Top\n        .Left = Range(\"h7\").Left\n    End With\n    With NewName\n        .Height = patok.Height * 2 - 4\n        .Width = patok.Width * 3\n        .Top = Range(\"h13\").Top\n        .Left = Range(\"h13\").Left\n    End With\n    With InputToData\n        .Height = patok.Height * 2 + 5\n        .Width = patok.Width * 3\n        .Top = Range(\"h16\").Top\n        .Left = Range(\"h16\").Left\n    End With\nEnd Sub<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Put the cursor anywhere between the <span style=\"background-color: LightGrey\">Sub SetActiveXControls<\/span> line and the <span style=\"background-color: LightGrey\">End Sub<\/span> line. Then run the &#8220;SetActiveXControls&#8221; sub by clicking the &#8220;play&#8221; button located in the VB Editor menu. It is a small green triangle icon pointed out by the red arrow in the image above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Minimize the VB Editor window to see the result on sheet &#8220;CUSU&#8221; after running this sub.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-03_worksheet-form-input.png\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"436\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-03_worksheet-form-input.png\" alt=\"\" class=\"wp-image-1302\"\/><\/a><figcaption><em>The size and the position of the controls now are not messy anymore<\/em><br><em>(please ignore the foreign name in the image)<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Next, Mr. Adi make sure that the cursor is under the <span style=\"background-color: LightGrey\">End Sub<\/span> text, as pointed out with the red arrow in the image below &#8230;.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-04_macro-for-activex-controls.png\"><img loading=\"lazy\" decoding=\"async\" width=\"554\" height=\"494\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-04_macro-for-activex-controls.png\" alt=\"\" class=\"wp-image-1303\"\/><\/a><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">then copy the codes below and paste them at the cursor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sub CU_Click()\n    'ActiveSheet.Unprotect\n    Application.EnableEvents = False\n    SearchBox.Value = \"\": SearchBox.Activate: ListName.Clear\n    Range(\"AA1\").Value = \"Customer\"\n    Range(\"E2\").Value = Range(\"AA2\").Value\n    Range(\"E3\").ClearContents\n    CU.BackColor = &amp;HC0C0FF\n    SU.BackColor = &amp;H8000000F&amp;\n    Item.BackColor = &amp;H8000000F&amp;\n    NewName.Caption = \"New Customer Name\"\n    Application.EnableEvents = True\n    'ActiveSheet.Protect\nEnd Sub\n\nSub SU_Click()\n    'ActiveSheet.Unprotect\n    Application.EnableEvents = False\n    SearchBox.Value = \"\": SearchBox.Activate: ListName.Clear\n    Range(\"AA1\").Value = \"Supplier\"\n    Range(\"E2\").Value = Range(\"AA3\").Value\n    Range(\"E3\").ClearContents\n    CU.BackColor = &amp;H8000000F&amp;\n    SU.BackColor = &amp;HC0C0FF\n    Item.BackColor = &amp;H8000000F&amp;\n    Kas_Bon.BackColor = &amp;HC0C0FF\n    NewName.Caption = \"New Supplier Name\"\n    Application.EnableEvents = True\n    'ActiveSheet.Protect\nEnd Sub\n\nPrivate Sub ITEM_Click()\n    'ActiveSheet.Unprotect\n    Application.EnableEvents = False\n    SearchBox.Value = \"\": SearchBox.Activate: ListName.Clear\n    Range(\"AA1\").Value = \"Item\"\n    CU.BackColor = &amp;H8000000F&amp;\n    SU.BackColor = &amp;H8000000F&amp;\n    Item.BackColor = &amp;HC0C0FF\n    NewName.Caption = \"New Item Name\"\n    Application.EnableEvents = True\n    'ActiveSheet.Protect\nEnd Sub\n\nPrivate Sub Kas_Bon_Click()\n    Kas_Bon.BackColor = &amp;HC0C0FF\n    If Kas_Bon.Caption = \"CASH\" Then _\n    Kas_Bon.Caption = \"NON CASH\": Range(\"c17\").Value = \"Non CASH\": Exit Sub\n    If Kas_Bon.Caption = \"NON CASH\" Then _\n    Kas_Bon.Caption = \"CASH\": Range(\"c17\").Value = \"CASH\":\nEnd Sub\n\nPrivate Sub SearchBox_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)\nApplication.EnableEvents = False\nSearchBox.Value = \"\"\nApplication.EnableEvents = True\nEnd Sub\n\nPrivate Sub SearchBox_Change()\nDim MyList As Variant, i As Long\n    \n    nm = Range(\"AA1\").Value\n    Set rng = Sheets(\"TABLE\").Range(nm)\n    \n    MyList = Application.Transpose(rng)\n    With ListName\n        If SearchBox.Value = \"\" Then\n            .Clear\n            '.List = MyList\n        Else\n            .Clear\n            For i = LBound(MyList, 1) To UBound(MyList, 1)\n                If LCase(MyList(i)) Like \"*\" _\n                &amp; LCase(SearchBox.Value) _\n                &amp; \"*\" Then .AddItem MyList(i)\n            Next i\n        End If\n    End With\n    If ListName.ListCount = 1 Then ListName.Selected(0) = True\nEnd Sub\n\nPrivate Sub ListName_Click()\n    'ActiveSheet.Unprotect\n    Application.EnableEvents = False\n    If Range(\"AA1\").Value = \"Item\" Then\n        Range(\"b20\").End(xlUp).Offset(1, 0).Value = Me.ListName.Value\n    Else\n        Range(\"E3\").Value = Me.ListName.Value\n    End If\n    'ActiveSheet.Protect\n    Application.EnableEvents = True\nEnd Sub\n\nPrivate Sub NewName_Click()\n    'ActiveSheet.unProtect\n    X = Range(\"AA1\").Value\n    xName = InputBox(\"Type the new \" + X + \" name\")\n    If xName = \"\" Then Exit Sub\n\n    Application.ScreenUpdating = False\n    With Sheets(\"TABLE\")\n    If Not .Range(X).Find(xName, lookat:=xlWhole) Is Nothing Then\n        MsgBox \"The new name you typed already in the sheet TABLE\"\n        Exit Sub\n    End If\n    LR = .Range(X).Rows.Count + 1\n    .Range(X)(LR, 1).Value = Application.Proper(xName)\n    End With\n    If X = \"Item\" Then\n        Range(\"B20\").End(xlUp).Offset(1, 0).Value = _\n        Application.Proper(xName)\n    Else\n        Range(\"E3\").Value = Application.Proper(xName)\n    End If\n    Application.ScreenUpdating = True\n    'ActiveSheet.Protect\nEnd Sub\n\nPrivate Sub InputToData_Click()\n    Set rngItem = Range(\"B7:B16\")\n    cnt = Application.CountA(rngItem)\n    Set sh = Sheets(\"SellBuy\")\n    Set sdt = Sheets(\"DATA\")\n    \n    'cek kesalahan\n    Call CekKesalahan\n    If Range(\"AA4\").Value = \"not oke\" Then Exit Sub\n    \n    Application.EnableEvents = False\n    Application.ScreenUpdating = False\n    \n    'persiapan di halaman HARIAN dan halaman DATA\n    idNota = Left(sh.Range(\"E2\"), 9)\n    Set rngKopi = Range(\"AA7\").Resize(cnt, 13)\n    Set awal = sdt.Range(\"B\" &amp; Rows.Count).End(xlUp).Offset(1, 0)\n    Set rngPaste = awal.Resize(cnt, 13)\n    \n    'input ke halaman DATA dan BACKUP transaksi ini\n    rngPaste.Value = rngKopi.Value\n    \n    'input KAS apabila CASH\n    If Range(\"C17\").Value = \"CASH\" Then\n        Set lunas = sdt.Range(\"B\" &amp; Rows.Count).End(xlUp)\n        lunas.Resize(1, 13).Copy\n        lunas.Offset(1, 0).PasteSpecial (xlValues)\n        lunas.Offset(1, 3).Value = \"CASH\"\n        sdt.Range(lunas.Offset(1, 5), lunas.Offset(1, 7)).ClearContents\n        lunas.Offset(1, 9).ClearContents\n        If lunas.Offset(1, 4).Value = \"CU\" Then\n            lunas.Offset(1, 8).Value = sh.Range(\"E17\").Value\n            lunas.Offset(1, 10).Value = \"DEBIT\"\n        Else\n            lunas.Offset(1, 8).Value = -sh.Range(\"E17\").Value\n            lunas.Offset(1, 10).Value = \"CREDIT\"\n        End If\n    End If\n    \n    'tampilkan pesan bahwa transaksi telah masuk data\n    Application.ScreenUpdating = True\n    sdt.Select\n    rngPaste.Select\n    ActiveWindow.ScrollRow = ActiveCell.Row\n    MsgBox \"Transaction already inputted to the Main Data\"\n    sh.Select\n    \n    'tambahin nomor nota\n    Nomor = Format(Right(Range(\"E2\"), 3)) + 1\n    NomorNota = idNota + Format(Nomor, \"000\")\n    Range(\"E2\").Value = NomorNota\n    \n    'pindahin nomor nota ke helper\n    If Left(NomorNota, 1) = \"C\" Then\n        Range(\"AA2\").Value = NomorNota\n    Else\n        Range(\"AA3\").Value = NomorNota\n    End If\n    \n    'bersihkan halaman HARIAN\n    Range(\"E3,B7:D16\").ClearContents\n    SearchBox.Value = \"\"\n    \n    'refresh Pivot Table\n    Sheets(\"CUSU\").PivotTables(\"ptCUSU\").PivotCache.Refresh\n    \n    Range(\"B7\").Select\n    \n    Application.EnableEvents = True\n    \n    'save file nya\n    'ActiveWorkbook.Save\nEnd Sub\n\nPrivate Sub CekKesalahan()\n    'cek apakah masih ada kolom yang diperlukan tapi kosong\nIf Range(\"E1\").Value = \"\" _\n    Or Range(\"E2\").Value = \"\" _\n    Or Range(\"E3\").Value = \"\" _\n    Or cnt = 0 _\n    Or Application.CountA(rngItem.Offset(0, 1)) &lt;&gt; cnt _\n    Or Application.CountA(rngItem.Offset(0, 2)) &lt;&gt; cnt Then\n    MsgBox \"There is an empty needed cell\"\n    Range(\"AA4\").Value = \"not oke\"\n    Exit Sub\nElse\n    Range(\"AA4\").Value = \"oke\"\nEnd If\n\n'cek apakah nomor nota yang akan di input sudah ada di data\nSet c = Sheets(\"DATA\").Columns(2).Find(Range(\"E2\").Value, lookat:=xlWhole)\nIf Not c Is Nothing Then\n    MsgBox \"The Invoice number \" + Range(\"E2\").Value + \" is already in the Main Data\"\n    Range(\"AA4\").Value = \"not oke\"\n    Exit Sub\nElse\n    Range(\"AA4\").Value = \"oke\"\nEnd If\n\nEnd Sub\n\nPrivate Sub Worksheet_Activate()\n    Call SetActiveXControls\n    Call tmpSellBuy\nEnd Sub\n\nSub tmpSellBuy()\nApplication.EnableEvents = False\nWith Sheets(\"SellBuy\")\nSet rg = .Range(\"AA7:AA16\")\nrg.Offset(0, 0).Formula = \"=$E$1\"\nrg.Offset(0, 1).Formula = \"=$E$2\"\nrg.Offset(0, 2).Formula = \"=$E$3\"\nrg.Offset(0, 3).Value = \"STOCK\"\nrg.Offset(0, 4).Formula = _\n\"=IF(LEFT(AB7,1)=\"\"C\"\",\"\"CU\"\",\"\"SU\"\")\"\nrg.Offset(0, 5).Formula = \"=B7\"\nrg.Offset(0, 6).Formula = \"=C7\"\nrg.Offset(0, 7).Formula = \"=D7\"\nrg.Offset(0, 8).Formula = \"=IF(AE7=\"\"CU\"\",-E7,E7)\"\nrg.Offset(0, 9).Formula = \"=IF(AE7=\"\"CU\"\",-AG7,AG7)\"\nrg.Offset(0, 10).Formula = _\n\"=IF(AE7=\"\"CU\"\",\"\"CREDIT\"\",\"\"DEBIT\"\")\"\nrg.Offset(0, 11).Formula = _\n\"=DATEVALUE(CONCATENATE(\"\"01-\"\",MID(AB7,6,2),\"\"-\"\",MID(AB7,4,2)))\"\nrg.Offset(0, 12).Formula = _\n\"=IF($C$17=\"\"CASH\"\",CONCATENATE(TEXT(AA7,\"\"yymm\"\"),\"\"PAID\"\"),\"\"\"\")\"\nEnd With\nApplication.EnableEvents = True\nEnd Sub\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Mr. Adi still add one more macro to have the invoice number reset to 001 when the file (Workbook) is opened for the first time on each day. This code will be put in the &#8220;ThisWorkbook&#8221; module.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the &#8220;Project- VBAProject&#8221; window, double click the &#8220;ThisWorkbook&#8221; to open its module. Copy the macro below then paste it on the module.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Private Sub Workbook_Open()\nDim MaxDate As Date\nMaxDate = WorksheetFunction. _\nMax(Sheets(\"DATA\").Range(\"B1:B50000\"))\nTglAkhir = Format(MaxDate, \"yymmdd\")\nNomorPatok = Format(Date, \"yymmdd\")\nIf NomorPatok &gt; TglAkhir Then\n    idCU = \"CU-\"\n    idSU = \"SU-\"\n    With Sheets(\"SellBuy\")\n        '.Unprotect\n        .Range(\"AA2\").Value = idCU + NomorPatok + \"001\"\n        .Range(\"AA3\").Value = idSU + NomorPatok + \"001\"\n        .Range(\"E2:E3\").ClearContents\n        '.Protect\n        ActiveWorkbook.Save\n    End With\n    End If\nEnd Sub<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The result will look like the sample image below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-05_macro-invoice-number-increment.png\"><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"559\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-05_macro-invoice-number-increment.png\" alt=\"\" class=\"wp-image-1304\"\/><\/a><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">In order the form visualization is not plain, Mr. Adi make some column adjustment and color the cells according to his like. The process is not covered here because it&#8217;s just a personal taste.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1140\" height=\"493\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-05b_form-input-jual-beli-excel.png\" alt=\"\" class=\"wp-image-1123\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">In the next page, Mr. Adi will test-run his Purchase\/Sales Form Macro for data entry to check whether it gives the result as expected or not.<\/p>\n\n\n\n<!--nextpage-->\n\n\n\n<h5 class=\"wp-block-heading\">TEST RUN<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Mr. Adi saves the file first, close the file, then open it again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Assumed that the date is 8 March 2021 and it is the first time he open the file on this day. So, when the CU button is clicked, it will show the invoice number like this : CU-210308001. When the SU button is clicked, it will show SU-210308001.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1153\" height=\"490\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-06_buy-and-sell-button.gif\" alt=\"\" class=\"wp-image-1306\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">CU\/SU is the indicator that it is a sales invoice or a purchase invoice. 210308 is the date format YYMMDD. And the 001 is the invoice number.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"text-decoration: underline;\"><strong>Example case for a new customer\/supplier\/item<\/strong><\/span><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Tante Linda is the name of the new customer, Om Pimpah is the name of the new supplier and Jengkol Bangkok is the name of the new product\/item.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Mr. Adi try to search those names by typing the name in the search box, the ListName box won&#8217;t give a result because those names do not exist in the sheet TABLE.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"298\" height=\"287\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-07_search-box-for-searching-name.gif\" alt=\"\" class=\"wp-image-1307\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">So now Mr. Adi inputs those new names. For customer Tante Linda, he click the &#8220;CU&#8221; button, then click the &#8220;New Customer Name&#8221; button, then type the new name, then click OK button in the input box window. As seen in the animation below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1218\" height=\"455\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-08_inputting-new-customer-name.gif\" alt=\"\" class=\"wp-image-1522\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, the last customer name in sheet TABLE is Aggil in cell B267. After the input, now the new Tante Linda supplier name is in cell B268. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now for the new supplier name, Om Pimpah.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-09_inputting-new-supplier-name.gif\" alt=\"\" class=\"wp-image-1309\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The last supplier name in sheet TABLE is PT. Angin Ribut in cell D32. After the input, now the new Om Pimpah supplier name is in cell D33.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now for the new product\/item name, Jengkol Bangkok.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-10_inputting-new-product-name.gif\" alt=\"\" class=\"wp-image-1310\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The last item name in sheet TABLE is Pork Bacon in cell F293. After the input, now the new Jengkol Bangkok item name is in cell F294.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now Mr. Adi checks if those names appear in the ListNames box if he type it in the SearchBox.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"532\" height=\"291\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-11_excel-form-search-box.gif\" alt=\"\" class=\"wp-image-1128\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">From the animation above, we see the ListName box show the result when Mr. Adi type the name in the SearchBox.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;if&#8221; condition for the ListName are like this:<br>If the ListName found one name only from the word typed in the SearchBox, it will directly put the name on the sheet. If the ListName found more than one result, the user need to click which name in the ListName that he wants to put it on the sheet.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"text-decoration: underline;\"><strong>Example case for Sales Data Entry<\/strong><\/span><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s been a week which has no transaction at all. No sales no purchase. So the Main Data in sheet DATA still contains just the opening balance data. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"195\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-12_product-opening-balance-data.png\" alt=\"\" class=\"wp-image-1312\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, on 8 March 2021, customer Agus Jova buy Item Aspic-Amber with a quantity 10 and the price is Rp 25.000\/each in cash.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"488\" height=\"380\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-13_product-opening-balance.png\" alt=\"\" class=\"wp-image-1313\"\/><figcaption><em>The opening balance of item Aspic is 39<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"539\" height=\"377\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-14_customer-opening-balance.png\" alt=\"\" class=\"wp-image-1314\"\/><figcaption><em>The opening balance of CU Agus Jova is 640.000<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1149\" height=\"505\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-15_input-customer-transaction.gif\" alt=\"\" class=\"wp-image-1315\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The data entry process as follow:<br>Click &#8220;CU&#8221; button, type agus in the search box, click Agus Jova in the ListName box, click &#8220;NON CASH&#8221; button if it read &#8220;NON CASH&#8221; in the button (just leave it alone if it read &#8220;CASH&#8221; in the button), click the Item button, type aspic in the search box, fill the quantity and the price in the form (under the QTY and PRICE column), then click &#8220;Input To Data&#8221; button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The macro then activate the sheet DATA to inform that data entry has been done by showing the result. The macro also put a &#8220;2103Paid&#8221; as a mark that invoice CU-210308001 is paid.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then it activate the sheet SellBuy again, and now the next CU invoice number is CU-210308002 as seen in the animation above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mr. Adi then check the sheet STOCK.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"483\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-16_pivot-table-product-balance.png\" alt=\"\" class=\"wp-image-1317\"\/><figcaption><em>Aspic Amber balance after the input<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The quantity of Aspic &#8211; Amber now less 10. Because this is a cash transaction, so there is no change on the amount of money Agus Jova owe Mr. Adi.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"text-decoration: underline;\"><strong>Example case for Purchase data entry<\/strong><\/span><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Mr. Adi buy Bread Crumb from Mr. Fauzan 5 pieces with the price 30,000\/pcs and item Capon &#8211; Breast 10 pieces @ 15.000. Non Cash.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"585\" height=\"508\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-17_product-opening-balance.png\" alt=\"\" class=\"wp-image-1318\"\/><figcaption><em>Opening balance for Bread Crumbs is 11, while Capon Breast is zero<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"370\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-18_supplier-opening-balance.png\" alt=\"\" class=\"wp-image-1319\"\/><figcaption><em>Opening balance Mr. Adi owe Mr. Fauzan is 150.000<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1099\" height=\"429\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-19_inputting-supplier-transaction.gif\" alt=\"\" class=\"wp-image-1320\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The Data Entry process is the similar.<br>Click &#8220;SU&#8221; button, type fauz in the search box, click Fauzan Novianti in the ListName box, click &#8220;CASH&#8221; button if it read &#8220;CASH&#8221; in the button (just leave it alone if it read &#8220;NON CASH&#8221; in the button), click the Item button, type bread c in the search box then type capo, fill the quantity and the price in the form (under the QTY and PRICE column), then click &#8220;Input To Data&#8221; button. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"620\" height=\"482\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-20_pivot-table-product-balance.png\" alt=\"\" class=\"wp-image-1322\"\/><figcaption><em>The balance for Bread Crumbs now is 16 and Capon now is 10<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"481\" src=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-21_pivot-table-supplier-balance.png\" alt=\"\" class=\"wp-image-1323\"\/><figcaption><em>The amount of money Mr. Adi owe Fauzan now is 300.000<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it. Mr Adi has completed the making of his Purchase\/Sales Form macro codes. In the next topic, he will make a UserForm via Visual Basic Editor. The UserForm will be used for payment data entry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If there is something which is not clear regarding to this topic, please don\u2019t hesitate to ask in the Comment box. I\u2019ll try my best to answer.<\/p>\n\n\n\n<div style=\"max-width:800px;text-align:right;\"><button style=\"width:auto\"><a style=\"color:white;\" href=\"https:\/\/www.indonesiangems.com\/blog\/download\/count.php?nm=Sample03b-En\">Download Excel Macro Form Jual Beli<\/a><\/button><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last updated on March 19th, 2021 at 06:24 am<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,12],"tags":[],"class_list":["post-1514","post","type-post","status-publish","format-standard","hentry","category-en","category-excel-application-en","tw-meta-no-icon"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Purchase\/Sales Form Macro Codes For Data Entry - part 4<\/title>\n<meta name=\"description\" content=\"Create a simple macro codes for a Purchase\/Sales data entry form. Just copy-paste the codes or download the sample file complete with macro.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/\" \/>\n<link rel=\"next\" href=\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Purchase\/Sales Form Macro Codes For Data Entry - part 4\" \/>\n<meta property=\"og:description\" content=\"Create a simple macro codes for a Purchase\/Sales data entry form. Just copy-paste the codes or download the sample file complete with macro.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/\" \/>\n<meta property=\"og:site_name\" content=\"Indonesian Gems Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-16T19:55:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-18T22:24:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-01_excel-visal-basic-editor-menu.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"15 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/#website\",\"url\":\"https:\/\/indonesiangems.com\/blog\/\",\"name\":\"Indonesian Gems Blog\",\"description\":\"just want to share what I&#039;ve done so far\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/indonesiangems.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/indonesiangems.com\/blog\/wp-content\/uploads\/2021\/03\/04-01_excel-visal-basic-editor-menu.png\",\"width\":674,\"height\":184},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/#webpage\",\"url\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/\",\"name\":\"Purchase\/Sales Form Macro Codes For Data Entry - part 4\",\"isPartOf\":{\"@id\":\"https:\/\/indonesiangems.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/#primaryimage\"},\"datePublished\":\"2021-03-16T19:55:26+00:00\",\"dateModified\":\"2021-03-18T22:24:28+00:00\",\"author\":{\"@id\":\"https:\/\/indonesiangems.com\/blog\/#\/schema\/person\/96961e74ef7272e067370a6e6c4d0efd\"},\"description\":\"Create a simple macro codes for a Purchase\/Sales data entry form. Just copy-paste the codes or download the sample file complete with macro.\",\"breadcrumb\":{\"@id\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/\",\"url\":\"https:\/\/indonesiangems.com\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/\",\"url\":\"https:\/\/indonesiangems.com\/blog\/excel-macro-purchase-sales-form-data-entry\/\",\"name\":\"Purchase\/Sales Form Macro Codes For Data Entry - part 4\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/#\/schema\/person\/96961e74ef7272e067370a6e6c4d0efd\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/indonesiangems.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/73e0be4b74509a0250ea0115a8fb8b5a132592a52df5ccc0013ac50eb087f578?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/indonesiangems.com\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/posts\/1514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/comments?post=1514"}],"version-history":[{"count":15,"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/posts\/1514\/revisions"}],"predecessor-version":[{"id":1615,"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/posts\/1514\/revisions\/1615"}],"wp:attachment":[{"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/media?parent=1514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/categories?post=1514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/indonesiangems.com\/blog\/wp-json\/wp\/v2\/tags?post=1514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}