Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Now You See Them Now You Don't (XP:SP)

    I have a Userform with a number of text boxes that I would like to make invisible upon activating the userform. I thought of using something like this:

    Private Sub UserForm_Activate()
    Dim i As Integer
    For i = 1 To 7
    TextBox(i).Visible = False This is the line I am having an issue with
    Next i
    End Sub


    I am looking for a better way of making them visible other than listing seven lines of code for each.

    Thanks,
    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Now You See Them Now You Don't (XP:SP)

    TextBox(i) is not valid. If the text boxes are named TextBox1 through TextBox7, you can use

    For i = 1 To 7
    Me.Controls("TextBox" & i).Visible = False
    Next i

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Now You See Them Now You Don't (XP:SP)

    Thanks Hans.

    Regards,
    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •