View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Greg Glynn Greg Glynn is offline
external usenet poster
 
Posts: 137
Default How to validate that input was entered into Input Box

Jonco,

Don't use InputBoxes. You're much better off with a UserForm. You
can add code to each of your data entry fields on a userform which, on
any change, triggers an event. This event checks to see if Box1 is
not empty and Box2 is not empty, and if true, then Box3 get enabled
for Data Entry.

Similar to this:

Sub CheckAssetOK()
If InfoCard.AssetNoInput.Value < "" And _
InfoCard.SiteCodeInput.Value < "" And _
InfoCard.ProductCodeInput.Value < "" And _
InfoCard.SerialNumberInput.Value < "" Then _
InfoCard.InfoOK.Enabled = True Else _
InfoCard.InfoOK.Enabled = False
End Sub

Private Sub SerialNumberInput_Change()
CheckAssetOK
End Sub

Private Sub SiteCodeInput_Change()
CheckAssetOK
End Sub

My form is called InfoCard. I have fields called AssetNoInput (for
Asset Numbers), SiteCodeInput, ProductCodeInput, SerialNumberInput.

When ALL of them are < "", then the OK button gets enabled. You need
to change the code to only enable InputBox3 when the first two have
data.

Hope this helps.