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 1b4494e..8d9dbee 100644 Binary files a/pricelevel.frx and b/pricelevel.frx differ