+ Reply to Thread
Results 1 to 13 of 13

Need Help Solving a problem with a Code

  1. #1
    Registered User
    Join Date
    03-27-2017
    Location
    Phoenix, Arizona
    MS-Off Ver
    2010, 2013
    Posts
    25

    Need Help Solving a problem with a Code

    I have a VBA Code that allows the user to select a date on a drop down menu, and when they click the submit button it asks them if they have the correct date before proceeding. When they hit ok it executes the script and copies data from each row into each sheet according to information found in column A.

    The problem that I'm having is that the operator needs to be able to pick any day of the year in order to back fill data, this spreadsheet will be rolling out in April, however the yearly data sheets show every day of the year since January 1st. When setting the date in the drop down menu the script cannot process a date more than a few days past the first available date in the other sheets.

    For example:

    If the yearly data sheets all start on January 1st and January 1st is the first available date, then I can enter the 1st and 2nd without issue, but if I enter in a random date from the year, for example today's date, March 27th the code fails and the coded error message appears.

    Is there someone who can help me to modify the code so that it will copy the data over to whichever date is selected, regardless of which dates are empty on the yearly sheets?

    Here is the entirety of the code:

    Please Login or Register  to view this content.
    Using Excel 2010

    Please let me know if I need to post additional information such as Screen Shots etc.

    Thank you.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need Help Solving a problem with a Code

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: Need Help Solving a problem with a Code

    A copy of your sheet would be very helpful in solving this.. But I have found the .find to be a bit funny with finding dates.. You might try formatting your "MyDate" into a number before running the search code.

    ie.
    Please Login or Register  to view this content.
    Not sure this will be much help but worth a try

  4. #4
    Registered User
    Join Date
    03-27-2017
    Location
    Phoenix, Arizona
    MS-Off Ver
    2010, 2013
    Posts
    25

    Re: Need Help Solving a problem with a Code

    Thank you both for replying so quickly.

    I tried the first suggestion made for edit to code, but every time I tried to click the button it just produced an error within the script.

    I will try to input the mydate change in and see how that works.

    I'm honestly not very good at VBA, so I'll do my best!

    What would be a good way to attach the sheet? Screenshots, or is there somewhere I can upload the sheet so that it can be downloaded and viewed?

  5. #5
    Registered User
    Join Date
    03-27-2017
    Location
    Phoenix, Arizona
    MS-Off Ver
    2010, 2013
    Posts
    25

    Re: Need Help Solving a problem with a Code

    I've created a dropbox and uploaded a copy of the document as it is. You'll notice that it works fine when entering dates that are within the earliest available, but it doesn't do well with advanced dates.

    https://www.dropbox.com/s/m1zglkm2pv...heet.xlsm?dl=0

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Need Help Solving a problem with a Code

    There was a typo in the code that mehmetcik posted. I have corrected it so you can try it again
    here is the corrected code..
    Please Login or Register  to view this content.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  7. #7
    Registered User
    Join Date
    03-27-2017
    Location
    Phoenix, Arizona
    MS-Off Ver
    2010, 2013
    Posts
    25

    Re: Need Help Solving a problem with a Code

    This is definitely making progress, I'm no longer getting an error code when I press the button. It still works when entering earliest dates, however when I enter a random date, for example March 17th or july 26th, the button will execute, but no data will actually copy over to the other sheets.

  8. #8
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: Need Help Solving a problem with a Code

    Try setting "MyDate" to the same format as the dates on your data sheets

    ie.
    Please Login or Register  to view this content.
    Put it into Module2

  9. #9
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: Need Help Solving a problem with a Code

    After looking at your sheet I changed a bit of formatting. See if this works for you

    Please Login or Register  to view this content.
    Last edited by unit285; 03-27-2017 at 05:08 PM.

  10. #10
    Registered User
    Join Date
    03-27-2017
    Location
    Phoenix, Arizona
    MS-Off Ver
    2010, 2013
    Posts
    25

    Re: Need Help Solving a problem with a Code

    Quote Originally Posted by unit285 View Post
    After looking at your sheet I changed a bit of formatting. See if this works for you
    Sorry for the delayed responses, thank you everyone! This last code is a perfect fix so far. I have run a few tests and every result so far has been perfect, appreciate everyone's help.

  11. #11
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Need Help Solving a problem with a Code

    Glad we were able to get it working for you through collective effort

  12. #12
    Registered User
    Join Date
    03-27-2017
    Location
    Phoenix, Arizona
    MS-Off Ver
    2010, 2013
    Posts
    25

    Re: Need Help Solving a problem with a Code

    Quote Originally Posted by gmr4evr1 View Post
    Glad we were able to get it working for you through collective effort
    Yes, thank you very much, all of you.

  13. #13
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: Need Help Solving a problem with a Code

    Glad to know its working for you

+ 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. I Need Help Solving This Problem
    By zZPingZz in forum Excel General
    Replies: 3
    Last Post: 07-09-2016, 09:04 AM
  2. Solving #REF! problem with vba
    By fetomy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2016, 09:25 AM
  3. could any 1 help me in solving this problem..
    By banilam in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-30-2013, 07:48 PM
  4. I need a help in solving this problem
    By jkarthi22 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-24-2007, 11:36 AM
  5. Solving Problem
    By jocpinmn in forum Excel General
    Replies: 2
    Last Post: 05-26-2007, 10:13 AM
  6. Need help solving this problem
    By Stan T in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-25-2006, 03:09 PM
  7. problem solving
    By ClayTele in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-16-2005, 03:04 PM

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