+ Reply to Thread
Results 1 to 19 of 19

Add date to table using date picker in a userform

  1. #1
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Add date to table using date picker in a userform

    Does anyone know a line of code that can add date to an excel table using the date picker on a user form. I keep getting 01/00/1900....Any help will be greatly appreciated.

    I have :

    Please Login or Register  to view this content.

    Pleeeasssseeee someone it will be a great big help.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    This should put the date chosen in the selected cells when you change the Date time picker.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    The thing is the rows in the table are added automatically using a user form a multi page userform. Once I keep adding data to the user form the rows increase by one.

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    Quote Originally Posted by Shellybelly View Post
    The thing is the rows in the table are added automatically using a user form a multi page userform. Once I keep adding data to the user form the rows increase by one.
    Hi Shelly,
    I'm not sure what you are saying. The original code you posted and I modified is event code that will run when you change the date on the date time picker. Changing the date triggers the code. What ever cells or cells are selected at the time you change the date in the date time picker should populate with the date you choose.

  5. #5
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    I have a code in the multi page userform that adds data to each column in the table then when hit finish and next it adds a new line.

    code:
    Please Login or Register  to view this content.
    Now when it creates the new table row the userform focuses on the date tab where I would have to select a date using the date picker. I would want the date selected goes to the 1st column as seen in the code( ThisWorkbook.Sheets("DATA LOG").Cells(nr, 1) = Me.DTPicker1.Value).

    I would really like to work with you to get it there?

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    Not a problem, but I really need to see the workbook. Can you post a copy of it with just a little bit of dummy.

    ViewPic

  7. #7
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    Sure thing....I've attached the Doc...In the "DATA LOG" tab you will see a blue button that says insert Schedule. Hit the button and the multi Page userform will show.ESG Bus Log123.xlsm

  8. #8
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    Okay I still don't get what you want.

    I don't find a date time picker.

    I see you have a multi tab form, there's a tab named Date with a combo box for picking the date. When I run the form and hit finish it puts the date chosen in column A of the Data Log sheet.

    This line of code is what is putting the date on the sheet:

    Please Login or Register  to view this content.
    Where is the date time picker and what is the issue with it?

  9. #9
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    When I select the date in the combo box it puts the date in the table as 1/0/1900 and not the actual date. for some reason the select date is not going in the table. I got that combo box when I select the Microsoft date time picker in the tools tab.

  10. #10
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    Okay here's what I've found so far.

    When I click on the INSERT SCHEDULE button the form opens on the Time In tab. I don't know if your actual file does that or not.

    After you input data into this tab and press next the code sends it to the final tab where you enter data and click finish. Since there is quite a bit of data missing I get a new line with a lot of data, including the date missing on the data log sheet.

    Your code however keeps the form open and selects the first tab which is the date tab. If I go through the process of entering data again, I have no problems because it goes through all the tabs and all data is entered correctly onto the form including the date. The date I get is the one I chose from the combo box and it's formatted d-mmm-yy.

    So if the workbook you are using is different than the copy you are sending me then I can't tell you why you are getting 1/0/1900 as I am not getting that.

    I did however learn something here, thanks for that.
    If in your version the form is not opening on the first tab, the date tab then do this. Go to where you designed the form and you will see that in the design view the tab that is coming up when you run the form is probably the tab that is selected. Just click on the date tab so that is the tab that is selected and save the workbook. I found that whatever tab is selected in design view is the tab that the form opens with.

    Regarding the date time picker I think maybe you just mistook the combo box control for the date time picker control. If you hover your mouse over each tool in the tool box you will get hover text showing you what each control is.

    The issue with putting a date time picker on your form now is this. There are many places in your code where the combo box is referenced. Some of those would have to be changed, some would have to be deleted.

    I could put one on the sheet you posted and fix all the code to make it work and post the file on this site. If you are going to then use that exact file you should be fine. If you are going to put a date time picker on your actual file and then replace the code in your actual file you would have to be careful to get all the code correctly edited/deleted.

    Another option is you put a date time picker on your actual form, I post all the old code that needs to be changed or deleted with instructions to either change or delete and then you would have to carefully make those changes.

    Let me know what you want to do, none of this is too much trouble for me, I just want you to be aware of what the issues are and the solutions that I can help you with.

    Please read this whole post carefully and respond in detail as to if your sheet is different which tab comes up what you want to do etc.

    Thanks.

  11. #11
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    ok nice skywriter...I follow what you are saying.....I can use the one you would post its no problem.

  12. #12
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    Hi skywriter I am so sorry it appears i attached the wrong file here is the correct file.
    Attached Files Attached Files

  13. #13
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    Try this file.

    If your original request is fulfilled please click the Thread Tools drop down box above your first post and choose solved.

    If you are happy with my help, please consider clicking the add reputation button in the lower left hand corner of this post.
    Attached Files Attached Files
    Last edited by skywriter; 05-27-2015 at 09:12 PM.

  14. #14
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    Hi SkyWriter for some reason the file is not open and if it does it erases all my contents any thoughts on that? Should I copy the sheets from the previous and past it in the worksheet that was repaired?

  15. #15
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    I'll post it again. I actually did very little to the file.

    What do you mean by it erases all your contents. It erases everything from all sheets? Please be specific.
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    So i received the new file and its refusing to open lol however I will send you new file so we can make the changes again. Not sure why it got corrupted though..but I am not worried.You're a big help.

    Lets try this one
    Attached Files Attached Files

  17. #17
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    This one has a combo box, not a date time picker.

  18. #18
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Re: Add date to table using date picker in a userform

    Hi Skywriter I got the doc to work for some reasons when I added slicers to the file it gets corrupt but i did a work around and it works great...Thanks sooooooo much..can't express how gratefull I am. I will certainly reward you with reputation points....Thanks again for such big help.

  19. #19
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Add date to table using date picker in a userform

    Thanks for the rep. points.

+ 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] Userform date picker - help required
    By nickhunt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2014, 03:39 PM
  2. Date picker UserForm to stay always in front of the main UserForm
    By Gabor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2014, 07:31 AM
  3. [SOLVED] Date Picker in UserForm will not add value to specified cell
    By clapforthewolfman in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-04-2013, 01:18 PM
  4. Date picker on userform
    By kieranbop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-14-2011, 05:18 AM
  5. Date Picker won't select current date: Userform
    By valkok in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-04-2011, 06:09 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