add test for invalid numbers

This commit is contained in:
Trowbridge 2020-01-10 11:07:40 -05:00
parent 4311b3b3e4
commit fdd3ce6d93

36
FL.bas
View File

@ -6,13 +6,13 @@ Public x As New TheBigOne
Sub Determine_Active_Range() Sub Determine_Active_Range()
Dim r As range Dim r As Range
Dim s As String Dim s As String
Dim cell As range Dim cell As Range
Set r = Selection Set r = Selection
MsgBox (r.Address) MsgBox (r.address)
For Each cell In r.Cells For Each cell In r.Cells
s = s & cell.value s = s & cell.value
@ -25,8 +25,8 @@ End Sub
Sub Cross_Join_Selection() Sub Cross_Join_Selection()
Dim x As New TheBigOne Dim x As New TheBigOne
Dim r As range Dim r As Range
Dim ar As range Dim ar As Range
Dim r1() As String Dim r1() As String
Dim r2() As String Dim r2() As String
Dim d() As String Dim d() As String
@ -237,7 +237,7 @@ End Function
Sub add_quote_front() Sub add_quote_front()
Dim r As range Dim r As Range
Set r = Selection Set r = Selection
Dim c As Object Dim c As Object
@ -248,7 +248,7 @@ Sub add_quote_front()
End Sub End Sub
Function json_from_list(keys As range, values As range) As String Function json_from_list(keys As Range, values As Range) As String
Dim json As String Dim json As String
Dim i As Integer Dim i As Integer
@ -284,7 +284,7 @@ Function json_nest(key As String, json As String) As String
End Function End Function
Function json_concat(list As range) As String Function json_concat(list As Range) As String
Dim json As String Dim json As String
Dim i As Integer Dim i As Integer
@ -685,9 +685,9 @@ Sub split_forecast_data()
End Sub End Sub
Function range_empty(ByRef r As range) As Boolean Function range_empty(ByRef r As Range) As Boolean
Dim c As range Dim c As Range
range_empty = True range_empty = True
For Each c In r.Cells For Each c In r.Cells
@ -724,7 +724,7 @@ Sub extract_price_matrix()
Dim unps() As String Dim unps() As String
Dim sql As String Dim sql As String
Dim error As String Dim error As String
Dim orig As range Dim orig As Range
Dim cms_pl() As String Dim cms_pl() As String
Dim pw As String Dim pw As String
Dim new_sh As Worksheet Dim new_sh As Worksheet
@ -751,6 +751,7 @@ Sub extract_price_matrix()
If UBound(tbl, 1) < 4 Then error = "selection is not a valid price matrix" If UBound(tbl, 1) < 4 Then error = "selection is not a valid price matrix"
If UBound(tbl, 2) < 2 Then error = "selection is not a valid price matrix" If UBound(tbl, 2) < 2 Then error = "selection is not a valid price matrix"
If Not error = "" Then If Not error = "" Then
MsgBox (error) MsgBox (error)
Exit Sub Exit Sub
@ -787,6 +788,15 @@ Sub extract_price_matrix()
unp(6, 0) = "orig_row" unp(6, 0) = "orig_row"
unp(7, 0) = "orig_col" unp(7, 0) = "orig_col"
If Not x.TBLp_TestNumeric(unp, 3) Then
MsgBox ("volume break quantity is text")
Exit Sub
End If
If Not x.TBLp_TestNumeric(unp, 5) Then
MsgBox ("price is text")
Exit Sub
End If
'-------------------------prepare sql to upload--------------------------------------------------------------- '-------------------------prepare sql to upload---------------------------------------------------------------
@ -794,6 +804,8 @@ Sub extract_price_matrix()
sql = "DECLARE GLOBAL TEMPORARY TABLE session.plbuild AS (" & sql & ") WITH DATA" sql = "DECLARE GLOBAL TEMPORARY TABLE session.plbuild AS (" & sql & ") WITH DATA"
Call wapi.ClipBoard_SetData(sql) Call wapi.ClipBoard_SetData(sql)
If MsgBox(sql, vbOKCancel, "continue with build?") = vbCancel Then Exit Sub
login.Show login.Show
If Not login.proceed Then Exit Sub If Not login.proceed Then Exit Sub
@ -880,7 +892,7 @@ Sub go_to_price_issue()
Dim ws As Worksheet Dim ws As Worksheet
Dim cp As CustomProperty Dim cp As CustomProperty
Dim orig As range Dim orig As Range
Dim trow As Long Dim trow As Long
Dim tcol As Long Dim tcol As Long
Dim i As Long Dim i As Long