+ Reply to Thread
Results 1 to 5 of 5

Using variable to hide large group of Textboxes in VB using For-next Loop

Hybrid View

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Question Using variable to hide large group of Textboxes in VB using For-next Loop

    Hi
    New to thread, very inexperienced user. Simply want to hide a large number of textboxes using .Hide. My syntax will not work, any ideas?

    Thanks for any help

    _________________________________________
    Private Sub CommandButton1_Click()
    For i = 1 To 2

    TextBox "i" & .Visible = False

    Next i
    End Sub
    __________________________________________________

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Using variable to hide large group of Textboxes in VB using For-next Loop

    Where are the textboxes located?

    Worksheet? Userform?

  3. #3
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Using variable to hide large group of Textboxes in VB using For-next Loop

    Sorry, its in a Userform.
    Thanks for quick reply.
    Greg

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Using variable to hide large group of Textboxes in VB using For-next Loop

    You can use the userform's Controls collection then
    Me.Controls("TextBox" & i).Visible = False

  5. #5
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Using variable to hide large group of Textboxes in VB using For-next Loop

    Norie
    You ROCK!!! Thanks
    Greg

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1