+ Reply to Thread
Results 1 to 11 of 11

code not working

  1. #1
    Registered User
    Join Date
    08-29-2007
    Posts
    45

    code not working

    I'm working on a sheet (file attached) that has a simple user form.

    I have two versions.. the first is working 100%, the second (attached) is not, and yet the code was copied from the first.

    Unfortunately I don't know enough about vba to figure out why it's not working.

    The other unsual thing is that if I run the code on my laptop (where the file was created) it workd fine. But when I copy the file across to the pc at work, it throws an error??

    Can anyone help?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello SRussell,

    Your attachment didn't post.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    08-29-2007
    Posts
    45
    ahhh.. it would help if I'd attached the file. :-)
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    06-13-2004
    Posts
    120
    It doesn't like your reference below...it doesnt like your reference to Date...

    What is the click event supposed to do, so I can try and debug it (and get the right outcome...)

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-13-2004
    Posts
    120
    Actually,

    Here is a fix for ya...you just needed to add a reference back to the DateTime class so it could find the Date member.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-29-2007
    Posts
    45
    I should've said exactly what pice of code wasn't working...

    Please Login or Register  to view this content.
    When I try to click OK on my form I get the following pop up "compile error: can't find object or library" and it takes me back to the code above with the C = highlighted on line 2.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello SRussell,

    You didn't declare C as a Range. Here is the revised command button code...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  8. #8
    Registered User
    Join Date
    08-29-2007
    Posts
    45
    Hello Leith Ross,

    thanks for the updated code...

    could you possibly explain why the code I supplied would work fine on one workbook, but not on another? Was it just luck??

  9. #9
    Registered User
    Join Date
    08-29-2007
    Posts
    45
    the original problem has now been solved, but I've now experienced a new error with some code.

    Please Login or Register  to view this content.
    This code is linked to a button which should automatically save the file with an updated date in the filename.

    When I click the button I get a compile error: can't find project ot library

    and the (Date + is highlighted.

    Can anyone help me with this?

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    In the VBE, do Tools > References, and see if one of the checked references says "Missing"

  11. #11
    Registered User
    Join Date
    08-29-2007
    Posts
    45
    Quote Originally Posted by shg
    In the VBE, do Tools > References, and see if one of the checked references says "Missing"

    excellent! thank you, works fine now.

+ 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