+ Reply to Thread
Results 1 to 6 of 6

Command button should be disable once user form is open

Hybrid View

  1. #1
    Forum Contributor geliedee's Avatar
    Join Date
    10-14-2013
    Location
    Manila, philippines
    MS-Off Ver
    Excel 2007
    Posts
    400

    Re: Command button should be disable once user form is open

    hi Mike,

    I have code that will search for details.

    You may see attached file.

    What i need is when i open the file, the proceed button should not appear.

    It will only appear if the search button has results... Then it can proceed to next step.
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Command button should be disable once user form is open

    Hi geliedee

    Add this Code to the UserForm Module
    Private Sub UserForm_Activate()
       Me.CommandButton2.Visible = False
    End Sub
    Modify this Code in the UserForm Module
    Private Sub CommandButton1_Click()
    
       Dim ws           As Worksheet
       Dim ID           As String
       Dim ID2          As Range
       Dim IDRow        As Long
    
       Set ws = Sheets("data base")
    
       ID = TextBox1
       Set ID2 = ws.Range("G:G").Find(what:=ID, LookIn:=xlValues, lookat:=xlWhole)
    
       If ID2 Is Nothing Then
    
          MsgBox "This ID does not appear in the data."
    
          Exit Sub
    
       Else
    
          IDRow = ID2.Row
          Me.CommandButton2.Visible = True '<---Add this Line of Code
       End If
    
       TextBox2 = ws.Cells(IDRow, 7)
       TextBox3 = ws.Cells(IDRow, 1)
       TextBox4 = ws.Cells(IDRow, 3)
       TextBox5 = ws.Cells(IDRow, 8)
       TextBox6 = ws.Cells(IDRow, 9)
       TextBox7 = ws.Cells(IDRow, 11)
       TextBox8 = ws.Cells(IDRow, 6)
       TextBox9 = ws.Cells(IDRow, 4)
    
    
    
    End Sub
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. Disable Command Button in User form
    By Lclarke11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2015, 07:50 AM
  2. enable disable user form option button group
    By bsapaka in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2014, 09:17 PM
  3. enable/disable a command button in User Form w/ condition
    By Bidyut Chakraborty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2014, 03:11 AM
  4. [SOLVED] Disable option button on user form??????
    By Bflare in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-27-2014, 04:42 PM
  5. [SOLVED] Confirm Command button on user form using VBA
    By coach.32 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-23-2013, 05:56 AM
  6. Help to creat user form with command button
    By sheree08 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2013, 04:10 PM
  7. Command Button on User form for Printing
    By Anthony Slater in forum Excel General
    Replies: 2
    Last Post: 09-07-2005, 03:05 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