First this code work fine as is, but i know there are better ways to do things.
Is there a better or more standard way to do the same thing like with loops, or a do while
or arrays ?
this code just checks if certain options & text boxes on a form are filled or chosen before it show the continue button.
Private Sub txtBlade_Change()
Call FillCells
End Sub
Private Sub txtLgthMinus_Change()
Call FillCells
End Sub
Private Sub txtLgthPlus_Change()
Call FillCells
End Sub
Private Sub txtSawDia_Change()
Call FillCells
End Sub
Private Sub txtSquareness_Change()
Call FillCells
End Sub
Private Sub txtTargetLgth_Change()
Call FillCells
End Sub
Private Sub txtTargetWt_Change()
FillCells
End Sub
Private Sub txtWtMinus_Change()
Call FillCells
End Sub
Private Sub txtWtPlus_Change()
Call FillCells
End Sub
Public Sub FillCells()
Dim dataerror(6) As Boolean
Dim a As Boolean
Dim b As Boolean
Dim c As Boolean
Dim d As Boolean
If optWeight.Value = False And optLength.Value = False Then a = False Else dataerror(0) = True
If optPounds.Value = False And optMM.Value = False And optGrams.Value = False And _
optInches.Value = False Then b = False Else dataerror(1) = True
If txtTargetWt.Value <> "0" And txtWtPlus.Value <> "0" And txtWtMinus.Value <> "0" _
Or txtTargetLgth.Value <> "0" And txtLgthPlus.Value <> "0" And txtLgthMinus.Value <> "0" Then dataerror(2) = True
If txtSquareness.Value <> "" Then dataerror(3) = True
If txtBlade.Value <> "" Then dataerror(4) = True
If txtSawDia.Value <> "" Then dataerror(5) = True
If optDiameterMM.Value = False And optDiameterInch.Value = False Then GoTo endcheck Else dataerror(6) = True
If dataerror(0) = True And dataerror(1) = True And dataerror(2) = True And dataerror(3) = True _
And dataerror(4) = True And dataerror(5) = True And dataerror(6) = True Then btnCalculate.Visible = True
endcheck:
End Sub
Start Free Trial