+ Reply to Thread
Results 1 to 10 of 10

Code VBA - command button update database

  1. #1
    Registered User
    Join Date
    08-07-2016
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    6

    Code VBA - command button update database

    hi all,
    I'm trying to build a time sheet database where each team member can fill in their time spent per week/day/project/project phase. I have build a worksheet for each member; they all look the same and include row 5:25 all projects and on columns I have Monday-Sunday (C4,E4,G4,I4,K4,M4,O4) and for each day a description cell where they can fill in the project phase from a drop-down list (D4,F4,H4,J4,L4,N4,P4). Above I have the team member name (A1) and end of week date (B2). Then I constructed a command button "Submit" which should transfer the data into a database sheet where I have the following headings: End of week, day, hours, project, project phase, team member (A2:F2) and which I want to be populated automatically when they click on the button.

    So far I have the following code but it returns only the first entry in the time-sheet, respectively the hours worked on Monday ("C4") on the first project ("B5").

    Do you know how to develop the code to look also into the following project lines (B6:B25) and to the following days (E4,G4,I4,K4,M4,O4)? Thanks so much!!

    Please Login or Register  to view this content.
    Last edited by VVex5; 08-07-2016 at 03:39 PM.

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

    Re: Code VBA - command button update database

    Hello and welcome to the Forum. Unfortunately your post does not comply with Rule 3 of the Forum. Please correct the issue.
    Rule
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button). The result will appear like this in the post window:
    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

  3. #3
    Registered User
    Join Date
    08-07-2016
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    6

    Re: Code VBA - command button update database

    hi Tom, thanks for pointing this out, now definitely looks better

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

    Re: Code VBA - command button update database

    You're welcome, and Thank you for fixing it. it not only makes it look better and easier to read, but it's easier for us to copy the code, all we have to do is click the icon above your code (I just found this out today lol).
    I forgot to ask this in my previous post...Can you attach a sample or the workbook with any code/UserForm(s) you may have with it?

  5. #5
    Registered User
    Join Date
    08-07-2016
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    6

    Re: Code VBA - command button update database

    database.JPG

    Database pic attached

  6. #6
    Registered User
    Join Date
    08-07-2016
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    6

    Re: Code VBA - command button update database

    Timesheet attached

    (file removed by admin)
    Last edited by FDibbins; 08-08-2016 at 10:13 AM.

  7. #7
    Registered User
    Join Date
    08-07-2016
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    6

    Re: Code VBA - command button update database

    file attached
    (file removed by admin)
    Last edited by FDibbins; 08-08-2016 at 10:13 AM.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Code VBA - command button update database

    As requested, I have removed your uploaded file from post # 6 (hope that was the correct 1?)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Code VBA - command button update database

    VVex, as requested, I have removed all of your attachments

  10. #10
    Registered User
    Join Date
    08-07-2016
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    6

    Re: Code VBA - command button update database

    Thanks! I attach hereby a clean version
    Copy of Time Tracker (2).xlsm

+ 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. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  2. [SOLVED] Need to update database with Update button on userform
    By asoler in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-03-2015, 08:13 PM
  3. [SOLVED] Run Command Prompt Icacls code in VBA Command Button on Userform
    By luismalave in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2015, 11:40 PM
  4. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  5. Code for a master command button to change the backcolor of multiple command buttons?
    By panttherm5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2012, 10:11 PM
  6. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  7. Automatically update existing data using a Update command button
    By 9999335 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 09:46 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