+ Reply to Thread
Results 1 to 2 of 2

Checkbox - Date

  1. #1
    Forum Contributor
    Join Date
    02-27-2007
    Posts
    156

    Checkbox - Date

    I have a Module on a worksheet that when I click on a checkbox it puts the date into the cell directly to the right of the checkbox. Works great... I now want that Module in a new workbook.

    I export the module to my desktop (Module1.bas)
    Copy a checkbox
    Close the workbook
    Open the new workbook
    Paste the checkbox
    Import the module
    Right click on the checkbox and Assign the Macro from THIS workbook.

    Now when I click it I get a compile error... "Compile Error - Can't find project or library" - the debugger is open and Sub Process_Checkbox() is highlighted in yellow and LNAME is grey... What did I miss? I must be tired...

    My code is here:

    Sub Process_CheckBox()

    Dim cBox As CheckBox
    Dim LCol As Long
    Dim LRow As Long
    Dim Rng As Range

    LName = Application.Caller
    Set cBox = ActiveSheet.CheckBoxes(LName)

    'Find row that checkbox resides in
    LCol = cBox.TopLeftCell.Column
    LRow = cBox.TopLeftCell.Row
    Set Rng = ActiveSheet.Cells(LRow + 1, LCol + 1)

    'Change date in cell to the right of CheckBox, if checkbox is checked
    If cBox.Value > 0 Then
    Rng.Value = Date

    'Clear date in column B, if checkbox is unchecked
    Else
    Rng.ClearContents
    End If

    End Sub

  2. #2
    Forum Contributor
    Join Date
    02-27-2007
    Posts
    156

    Post Latest Update

    I tried a few things on this... I opened a new workbook, imported the .bas file to create the module, copied my worksheet from the workbook that it is NOT working in and pasted it into this new workbook. I linked the macro and IT WORKED!!!

    What I need to figure out is why it will NOT work on a worksheet in the original workbook. I must have a setting or missing module or something that is preventing it from functioning.
    Attached Images Attached Images

+ 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