make a checkbox to format customer list as numeric

This commit is contained in:
Paul Trowbridge 2022-06-01 16:32:23 -04:00
parent edcd42947f
commit e377d8287b
2 changed files with 30 additions and 11 deletions

View File

@ -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

Binary file not shown.