diff --git a/Master Template.xlsm_EXPORTS/shipDateShifter.frm b/Master Template.xlsm_EXPORTS/shipDateShifter.frm index 30091b1..e7f47cb 100644 --- a/Master Template.xlsm_EXPORTS/shipDateShifter.frm +++ b/Master Template.xlsm_EXPORTS/shipDateShifter.frm @@ -25,7 +25,6 @@ Private Sub cmdCancel_Click() End Sub Private Sub cmdOK_Click() - 'build json Dim adjust As Object Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & ", ""distributions"":[]}") adjust("scenario")("version") = handler.plan @@ -49,7 +48,7 @@ Private Sub cmdOK_Click() Set distribution = JsonConverter.ParseJson( _ "{""ship_season"":" & selectedSeason & "," & _ " ""ship_month"": """ & Me.Controls("lblShipMonth" & Format(m, "00")).Caption & """," & _ - " ""pct"":" & Val(Replace(lblPctMonth(selectedSeason, m).Caption, "%", "")) / 100 & _ + " ""pct"":" & Val(RemoveFormat(month.text)) / currentValue & _ "}") adjust("distributions").Add distribution End If @@ -62,7 +61,7 @@ Private Sub cmdOK_Click() Set distribution = JsonConverter.ParseJson( _ "{""ship_season"":" & selectedSeason + 1 & "," & _ " ""ship_month"": """ & Me.Controls("lblShipMonth" & Format(m, "00")).Caption & """," & _ - " ""pct"":" & Val(Replace(lblPctMonth(selectedSeason + 1, m).Caption, "%", "")) / 100 & _ + " ""pct"":" & Val(RemoveFormat(month.text)) / currentValue & _ "}") adjust("distributions").Add distribution End If @@ -129,6 +128,7 @@ Private Sub cmdOK_Click() Call Utils.SHTp_DumpVar(res, shData.Name, i, 1, False, False, True) shShipments.PivotTables("ptShipments").PivotCache.Refresh + Unload Me End Sub Private Sub UserForm_Activate() @@ -141,7 +141,8 @@ Private Sub UserForm_Activate() .BackColor = &H80000018 .Enabled = False End With - + UpdatePercentages + lblSeasonCurrent.Caption = selectedSeason lblSeasonNext.Caption = selectedSeason + 1 End Sub @@ -208,6 +209,13 @@ Private Function Recalculate(updated As MSForms.TextBox) As Boolean ApplyFormatting txtSelectedMonth lblWarning.Visible = before > 0 + UpdatePercentages + + Recalculate = False ' Success +End Function + +Private Sub UpdatePercentages() + Dim m As Integer For m = 1 To 12 If txtMonth(selectedSeason, m).text = "" Then lblPctMonth(selectedSeason, m).Caption = "" @@ -220,8 +228,7 @@ Private Function Recalculate(updated As MSForms.TextBox) As Boolean lblPctMonth(selectedSeason + 1, m).Caption = Format(txtMonth(selectedSeason + 1, m).text / currentValue, "0%") End If Next - Recalculate = False ' Success -End Function +End Sub ' Remove formatting before editing a textbox. After editing, restore formatting, diff --git a/Master Template.xlsm_EXPORTS/shipDateShifter.frx b/Master Template.xlsm_EXPORTS/shipDateShifter.frx index 7b79228..85b8fb9 100644 Binary files a/Master Template.xlsm_EXPORTS/shipDateShifter.frx and b/Master Template.xlsm_EXPORTS/shipDateShifter.frx differ