Originally Posted by
melpa
Could you please explain the advantages of using .Visible in preference to .Enabled ?
Both of the solutions given appear to work equally well with either choice.
.Visible = False hides the control
.Enabled = False dims the control but you can still see it, but can't use it or tab to it
FWIW if a control is not applicable based on settings, then I hide it. If it's applicable but it's not ready to use I usually dim it until all required fields are entered
Demo
Option Explicit
Private Sub TextBox1_Change()
CommandButton1.Enabled = Len(TextBox1.Text) > 0 And Len(TextBox2.Text) > 0 And Len(TextBox4.Text) > 0
End Sub
Private Sub TextBox2_Change()
TextBox3.Visible = (LCase(TextBox2.Value) <> "x")
CommandButton1.Enabled = Len(TextBox1.Text) > 0 And Len(TextBox2.Text) > 0 And Len(TextBox4.Text) > 0
End Sub
Private Sub TextBox3_Change()
CommandButton1.Enabled = Len(TextBox1.Text) > 0 And Len(TextBox2.Text) > 0 And Len(TextBox4.Text) > 0
End Sub
Private Sub TextBox4_Change()
CommandButton1.Enabled = Len(TextBox1.Text) > 0 And Len(TextBox2.Text) > 0 And Len(TextBox4.Text) > 0
End Sub
Private Sub UserForm_Initialize()
CommandButton1.Enabled = False
End Sub