+ Reply to Thread
Results 1 to 2 of 2

Enable text box VBA

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    390

    Enable text box VBA

    Hi All,

    I have a optionbutton and few text boxes (which are disabled) in a userform and I was wondering is there a way to enable all text boxes instead of one at once to avoid doing individually. I use the following code to enable all at once but I want one of them to be kept diasabled. What shall I add to the following to make it happen?

    Thanks

        For Each ctl In Me.Controls
            If TypeName(ctl)="TextBox" AND OptionButton1.Enabled = True Then
                ctl.Enabled = True
            End If
        Next ctl

  2. #2
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    390

    Re: Enable text box VBA

    I figured it out. I am posting the code in case if anyone having a same problem too.

    Private Sub OptnbtnYes_Click()
    For Each ctl In Me.Controls
            If TypeName(ctl) = "TextBox" And Me.OptnbtnYes.Enabled = True And ctl.Name <> "txtOpexOvrll" Then
                ctl.Enabled = True
                ctl.BackStyle = fmBackStyleOpaque
            End If
        Next ctl
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to save macro enable file without selecting macro enable option?
    By Imran Magsi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2016, 02:37 AM
  2. Replies: 0
    Last Post: 08-06-2013, 08:21 AM
  3. [SOLVED] Convert Number to Text (to enable vlookup)
    By kenny.fsw in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-26-2013, 08:03 AM
  4. How Do I Enable a Text Box by Selecting a Value in a Combo List?
    By stuu3270 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-03-2013, 06:58 PM
  5. Big challenge: protect multiple sheets AND enable outlining AND enable insert comment
    By visschercaravelle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-23-2010, 11:46 AM
  6. VBA select default Don't Enable / Enable macros Setting
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2006, 03:50 PM
  7. [SOLVED] enable a scrolling cell with lengthy text within a worksheet?
    By paypalian in forum Excel General
    Replies: 0
    Last Post: 03-11-2005, 03:06 PM

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