From e377d8287bef5ba1ce20aa0ba15b5db9d47a0a25 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 1 Jun 2022 16:32:23 -0400 Subject: [PATCH] make a checkbox to format customer list as numeric --- PriceLists.bas | 41 ++++++++++++++++++++++++++++++----------- pricelevel.frx | Bin 3608 -> 4120 bytes 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/PriceLists.bas b/PriceLists.bas index 847fc80..78e3924 100644 --- a/PriceLists.bas +++ b/PriceLists.bas @@ -586,8 +586,28 @@ Sub build_customer_files() nwb.Activate Set nws = nwb.Sheets(1) nws.Activate - nws.Cells.NumberFormat = "@" 'format all cells to text so pasted text values are not cast to numeric - Call x.SHTp_Dump(pl, nws.Name, 5, 1, False, True) + nws.Cells.NumberFormat = "@" + '---------------------format to numeric if selected--------------------------------------------------------- + If pricelevel.cbNUMERIC Then + Call x.SHTp_Dump(pl, nws.Name, 1, 1, False, True, 9, 12, 15, 10, 13, 16) + Rows("1:4").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove + nws.Columns(10).NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""???_);_(@_)" + nws.Columns(13).NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""???_);_(@_)" + nws.Columns(16).NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""???_);_(@_)" + nws.Columns(11).NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""???_);_(@_)" + nws.Columns(14).NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""???_);_(@_)" + nws.Columns(17).NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""???_);_(@_)" + nws.Columns(10).ColumnWidth = 13 + nws.Columns(13).ColumnWidth = 13 + nws.Columns(16).ColumnWidth = 13 + nws.Rows(5).NumberFormat = "@" + Else + Call x.SHTp_Dump(pl, nws.Name, 5, 1, False, True) + nws.Columns(10).ColumnWidth = 10.57 + nws.Columns(13).ColumnWidth = 10.57 + nws.Columns(16).ColumnWidth = 10.57 + End If + Application.ScreenUpdating = False '---------------------whole sheet formatting---------------------------------------------------------------- @@ -619,9 +639,6 @@ Sub build_customer_files() nws.Columns(12).WrapText = True nws.Columns(15).ColumnWidth = 8.29 nws.Columns(15).WrapText = True - nws.Columns(10).ColumnWidth = 10.57 - nws.Columns(13).ColumnWidth = 10.57 - nws.Columns(16).ColumnWidth = 10.57 nws.Columns(11).ColumnWidth = 11.71 nws.Columns(14).ColumnWidth = 11.71 nws.Columns(17).ColumnWidth = 11.71 @@ -1024,15 +1041,17 @@ Sub print_setup(sheet As Worksheet, last_row As Long) End Sub -Public Function plevel_segment(plevel, segment_num) As String +Public Function plevel_segment(plevel As String, segment_num As Integer) As String - Dim i As Long - Dim j As Long - Dim loc As String - loc = "U.BOC.DI" Dim ret() As String + + ret = tbo.TXTp_ParseCSV(plevel, ".") - plevel_segment = tbo.TXTp_ParseCSV(loc, ".")(segment_num + 1) + If segment_num - 1 > UBound(ret) Then + plevel_segment = "" + Else + plevel_segment = ret(segment_num - 1) + End If End Function diff --git a/pricelevel.frx b/pricelevel.frx index 1b4494e448355499a73bcea331d20ff2c1763be2..8d9dbeed480a9c1163e6abdb517bd79f1c3f0ac9 100644 GIT binary patch delta 465 zcmXYt-z$Sr7{{OUdbi$fXKa`s8#+nMD>WA+DZe#^gk5W1!}4xt-q%{D{J5hed2U=$ zt|js>xRg8P)`h=7DJie#T~2+@bNZg|d48PBmP_HC9oGOt58h72;{|}<$3A6Ai5znC z?5p_3sz@4jbz19q6db`fb&zdg*mIz?RN;lE9B!nme8m93DAr)Bx2G>ir)uKYahwpv zFi}g?5%olbXdvACCO1B8U$Y3PaY*tIuOUSp1#ldIHtg1hICm9=wo_I>sm1(b%SnJe zQhM-N8^9Os1Y^D~-1l+P@YMI+Oy;FcSrRk(os5;0mKc}TTE?;gul&h|_vmESE|}?E zF=m=#LYmUDGZx-!ZEO-({LMPOKfI;3-5LqXH7%`NdPgi+StFa@5NTV?7ju-@0KC%# zMgt=_tj3s*sXzxaupIbt8!2&}Nxb2Dzb)aZmD<%Q7sTO%{>n!s+)>wv07Su9olnh8 pEzV4UQSp|0@s)Qp$x09HD!CL6?p&V-3>@~zf{hH%gUA0Q{s0S{YpMVM delta 339 zcmbQCFhhpT$BBc1fo~(58q;P2rWcG88(1bwu;hpeRNvmySa^exnSp_!ffYyqLE2aEYLn|Yd6*IlCiigul#qVF z7@Uz`uHczhl3J9RU!>raUzCzsR6O}1hvMXYTpB?4yJQv@lUsRJfT0I+ffCE+gS_I50B0sr AVE_OC