+ Reply to Thread
Results 1 to 4 of 4

CheckBox in Userform

Hybrid View

  1. #1
    Registered User
    Join Date
    03-12-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2003
    Posts
    55

    CheckBox in Userform

    Dear all,

    Can you please guide me, how to update the same date into another sheet when i select the checkbox . the Following code i am using to save data.
    Private Sub cmdAdd_Click()
    'dimention the variable
    Dim DataSH As Worksheet
    Dim Addme As Range
    'set the variable
    Set DataSH = Sheet2
    'error handler
    On Error GoTo errHandler:
    'set variable for the destination
    Set Addme = DataSH.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
    'hold in memory and stop screen flicker
    Application.ScreenUpdating = False
    If Me.txtSurname = "" Or Me.txtFirstName = "" Or Me.txtAddress = "" Then
    MsgBox "There is insufficient data, Please return and add the needed information"
    Exit Sub
    End If
    'send the values to the database
    With DataSH
    'add the unique reference ID then all other values
    Addme.Offset(0, -1) = DataSH.Range("C6").Value + 1
    Addme.Value = Me.txtSurname
    Addme.Offset(0, 1).Value = Me.txtFirstName
    Addme.Offset(0, 2).Value = Me.txtAddress
    Addme.Offset(0, 3).Value = Me.txtPhone
    Addme.Offset(0, 4).Value = Me.txtMobile
    Addme.Offset(0, 5).Value = Me.txtEmail
    End With
    'sort the data by "Surname"
    DataSH.Select
    With DataSH
    .Range("B9:H10000").Sort Key1:=Range("C9"), Order1:=xlAscending, Header:=xlGuess
    End With
    'sort the data by "Surname"
    'clear the values after entry
    Clear
    'communicate with the user
    MsgBox "Your student data was successfully added"
    'return to interface sheet sheet
    Sheet1.Select
    'reset the form
    On Error GoTo 0
    Exit Sub
    errHandler:
    'if error occurs then show me exactly where the error occurs
    MsgBox "Error " & Err.Number & _
    " (" & Err.Description & ")in procedure cmdClear_Click of Form StudentDB"
    End Sub

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,190

    Re: CheckBox in Userform

    if chkBox.value then sheets("sheet2").range("b1").value = me.txtDate

  3. #3
    Registered User
    Join Date
    03-12-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: CheckBox in Userform

    Will you be able to fix this in to my code ?
    Checkbox name = CheckBox1
    I want the data in Sheet6
    The Following data should be capture in "Sheet6" when in click on the cmdAdd Button
    'add the unique reference ID then all other values
    Addme.Offset(0, -1) = DataSH.Range("C6").Value + 1
    Addme.Value = Me.txtSurname
    Addme.Offset(0, 1).Value = Me.txtFirstName
    Addme.Offset(0, 2).Value = Me.txtAddress
    Addme.Offset(0, 3).Value = Me.txtPhone
    Addme.Offset(0, 4).Value = Me.txtMobile
    Addme.Offset(0, 5).Value = Me.txtEmail

  4. #4
    Registered User
    Join Date
    03-12-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2003
    Posts
    55

    Re: CheckBox in Userform

    Any Help ?

+ 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] Make Worksheet Active-X CheckBox value same as Userform CheckBox value
    By L plates in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2016, 08:23 AM
  2. [SOLVED] Checkbox problem on userform
    By Villalobos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-31-2014, 08:02 PM
  3. [SOLVED] Userform - checkbox
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2014, 01:49 PM
  4. Get UserForm checkbox caption and pass to another UserForm on click or mouse down
    By tulsaguy71 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-08-2013, 11:07 AM
  5. UserForm and CheckBox
    By zplugger in forum Excel General
    Replies: 4
    Last Post: 12-05-2011, 10:39 AM
  6. Userform Checkbox
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2006, 05:15 PM

Tags for this Thread

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