+ Reply to Thread
Results 1 to 3 of 3

Disable Button after one click user wise

  1. #1
    Registered User
    Join Date
    07-08-2011
    Location
    USA
    MS-Off Ver
    MS Office Home and Student 2019
    Posts
    25

    Disable Button after one click user wise

    Hi,

    I've created a timesheet with user form for Login, Logout, Break start and End buttons. What am looking for is once a user clicks on any of the four buttons, the user should not be allowed to again click the same butotn on same day. This way i can stop overwrite data.

    Request your help. Your immediate resolution will be highly appreciated

    Attached is the protected worksheet and i've copied my macro for Login button.

    Private Sub CommandButton1_Click()
    'Your code here
    CommandButton1.Enabled = False
    'LOGIN BUTTON

    Dim iHour As Integer, iMin As Integer, iSec As Integer

    Cells(CurRow, "D") = Time
    iHour = Hour(Now())
    iMin = Minute(Now()) + 30
    iSec = Second(Now())

    'c.Value = TextBox1.Value ' write amendments to database
    Cells(CurRow, "D").Value = Time

    Label1.Caption = ""
    TextBox1.Value = ""
    TextBox1.SetFocus
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Disable Button after one click user wise

    Please keep in mind that forum rules require you to post your code in code tags. Please edit your post and put the VBA code part of your code between code tags.

    I think your best bet is to disable the button once there is any text in the corresponding cell. To specify, instead of disabling a button after it's clicked, check the cell to see if there is any text once the button is clicked.

    If you need additional help, please post a copy of your workbook with the VBA project unlocked

  3. #3
    Registered User
    Join Date
    07-08-2011
    Location
    USA
    MS-Off Ver
    MS Office Home and Student 2019
    Posts
    25

    Re: Disable Button after one click user wise

    Thanks BB... Please let me know how can delete this or mark Solved so I can post new thread. Checked in "Go Advanced" however i couldn't see any option

+ 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