+ Reply to Thread
Results 1 to 8 of 8

Check box to clear once I press transfer data button

  1. #1
    Registered User
    Join Date
    05-01-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Check box to clear once I press transfer data button

    Hello,

    I need a code so from my user form when I check a box and filled in my user form and then transfer data to my spreadsheet

    I can get the text all to transfer and it clears the user form but what code do I need to use help me clear the check boxes

    Below is the code I have used to transfer the text from my user form to cell b10 and all the text in text box one is all transferred over

    Private Sub TRANSFER_DATA_Click()
    With TextBox1
    Sheets("sheet1").Range("B10").Value = .Text
    .Text = ""
    End With
    End Sub



    Currently with my check box once I click on it so it highlights a cell it does it straight away wait until I have pressed my button.

    Have I got the code in the wrong place and also what is the correct code. I have pasted my coding sorry for it being soo long.


    Private Sub CheckBox1_Click()
    If CheckBox1.Value = True Then
    Worksheets("Sheet1").Range("H4") = "TRACE DRIVER"
    Else
    Worksheets("Sheet1").Range("H4").ClearContents
    End If

    End Sub

    Private Sub CheckBox2_Click()
    If CheckBox2.Value = True Then
    Worksheets("Sheet1").Range("H5") = "CCTV REQUEST"
    Else
    Worksheets("Sheet1").Range("H5").ClearContents
    End If
    End Sub

    Private Sub CheckBox3_Click()
    If CheckBox3.Value = True Then
    Worksheets("Sheet1").Range("d2") = "YES"
    Else
    Worksheets("Sheet1").Range("D2").ClearContents
    End If
    End Sub

    Private Sub CheckBox4_Click()
    If CheckBox4.Value = True Then
    Worksheets("Sheet1").Range("H6") = "ACTION REQUIRED"
    Else
    Worksheets("Sheet1").Range("H6").ClearContents
    End If
    End Sub

    Private Sub CheckBox5_Click()

    End Sub


    Private Sub Close_Form_Click()
    Unload data_entry
    End Sub


    Private Sub OptionButton1_Click()
    If OptionButton1.Value = True Then
    Worksheets("Sheet1").Range("d2") = "YES"
    Else
    Worksheets("Sheet1").Range("D2").ClearContents
    End If
    End Sub

    Private Sub OptionButton2_Click()
    If OptionButton1.Value = True Then
    Worksheets("Sheet1").Range("d2") = "YES"
    Else
    Worksheets("Sheet1").Range("D2").ClearContents
    End If

    End Sub




    Private Sub TRANSFER_DATA_Click()
    With TextBox1
    Sheets("sheet1").Range("B10").Value = .Text
    .Text = ""
    End With
    With TextBox2
    Sheets("sheet1").Range("B14").Value = .Text
    .Text = ""
    End With
    With TextBox3
    Sheets("sheet1").Range("B16").Value = .Text
    .Text = ""
    End With
    With TextBox4
    Sheets("sheet1").Range("B19").Value = .Text
    .Text = ""
    End With
    With TextBox5
    Sheets("sheet1").Range("g19").Value = .Text
    .Text = ""
    End With
    With TextBox6
    Sheets("sheet1").Range("g10").Value = .Text
    .Text = ""
    End With
    With TextBox9
    Sheets("sheet1").Range("g14").Value = .Text
    .Text = ""
    End With
    With TextBox7
    Sheets("sheet1").Range("a23").Value = .Text
    .Text = ""
    End With
    With TextBox8
    Sheets("sheet1").Range("a29").Value = .Text
    .Text = ""
    End With
    With TextBox10
    Sheets("sheet1").Range("B2").Value = .Text
    .Text = ""
    End With
    With CheckBox5.Value = True
    Sheets("sheet1").Range("g56").Value
    .Text = ""
    End With



    End Sub

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Check box to clear once I press transfer data button

    HI Y'all,

    Welcome to the Forum!

    Try this:

    Please Login or Register  to view this content.
    BTW:

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Last edited by xladept; 05-02-2015 at 06:04 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    05-01-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Re: Check box to clear once I press transfer data button

    sorry for not putting the vba into a code.

    where am I putting the code you gave me. I had a ago but I get a debug message and cannot work it out at all.
    Is there a way I can send you my file to look at?

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Check box to clear once I press transfer data button

    Hi Y'all,

    If it's less than 1mb you can post it here - to whit:

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    But, if it's bigger than than that - you could dropbox it.

    And, if it's confidential - my e-mail is [email protected]

  5. #5
    Registered User
    Join Date
    05-01-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Re: Check box to clear once I press transfer data button

    I have uploaded the file, my work is using a very very old Microsoft office I think its the 2003 so I have to be careful in the functions I use as not all of them work there


    I am trying to get a VBA code to clear the form from the check boxes once I transfer data
    Attached Files Attached Files

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Check box to clear once I press transfer data button

    Hi Y'all,

    I've devised a workaround:

    In the standard module:

    Please Login or Register  to view this content.
    And the CheckBox#_Click() events:

    Please Login or Register  to view this content.
    BTW - where is CheckBox3??
    Last edited by xladept; 05-10-2015 at 07:58 PM.

  7. #7
    Registered User
    Join Date
    05-01-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    7

    Re: Check box to clear once I press transfer data button

    Check box 3 no longer exist.
    That has been replaced with the sub option.
    I kept getting an error message as the cells had been merged.
    The cell D2 & E2. The sub now runs in D2 with some simple formatting
    I need to view this on my pc. Poor samsung do not let me fully open the file

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Check box to clear once I press transfer data button

    Hi Y'all,

    I edited the UFCB code to eliminate the Application.EnableEvents which is ignored in Userforms anyway

+ 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. help for vba code where row hide/unhide & transfer data when we press Y
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 08:47 AM
  2. Press submit button and send data to Access
    By Charonix in forum Access Tables & Databases
    Replies: 1
    Last Post: 01-08-2014, 02:34 PM
  3. Replies: 1
    Last Post: 08-23-2013, 05:45 PM
  4. Replies: 17
    Last Post: 05-19-2009, 11:34 AM
  5. I keep losing my function when I press a clear button macro!
    By LtsGo4ARide in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2007, 01:56 AM

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