+ Reply to Thread
Results 1 to 16 of 16

How to Add/Update data based on employee id

  1. #1
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    How to Add/Update data based on employee id

    Hi All,

    I can't understand how to Add/Update the data (as per attached image) in "ShiftTemplate" sheet based on last 6 digits of employee id (txtEmployeeID). I have tried to do it but it is not working . please help me
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to Add/Update data based on employee id

    What part are you having a problem with; matching the ID?

    This will find the employee ID in column A

    Please Login or Register  to view this content.
    It's the same method you used in the cboEmpl_change procedure.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: How to Add/Update data based on employee id

    when I run this code i am getting error. Please help me to resolve this error.

    Also i need one more help.

    1. i want to update the numeric value of the month (selected in combo box) in excel sheet.

    Can any one help me?
    Attached Images Attached Images
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to Add/Update data based on employee id

    .Cells(x, 2).Value = Me.cbomonth.ListIndex + 1
    .Cells(x, 3).Value = Val(Me.cboyear.Value)

  5. #5
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: How to Add/Update data based on employee id

    Hi AlphaFrog,

    i am using your said code but getting an error. Please check the code (in the attached list) and let me know where i am doing mistake.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to Add/Update data based on employee id

    It worked for me using your latest workbook.

    What is the error description and what line of code is highlighted?

  7. #7
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: How to Add/Update data based on employee id

    Please find attached the error images
    Attached Images Attached Images

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to Add/Update data based on employee id

    The only way I can get that error is if there is no employee selected.

  9. #9
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: How to Add/Update data based on employee id

    i can't understand how to resolve it.

  10. #10
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to Add/Update data based on employee id

    What employee did you select?

  11. #11
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: How to Add/Update data based on employee id

    Hi AlphaFrog,

    I have changed the code and resolved the issue.
    Please Login or Register  to view this content.
    Last edited by Sanjibghosh; 11-07-2016 at 04:29 AM.

  12. #12
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: How to Add/Update data based on employee id

    Hi AlphaFrog,

    i need one more help. how to add 0 before the month (exmaple- 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11,12).
    Last edited by Sanjibghosh; 11-07-2016 at 04:32 AM.

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,913

    Re: How to Add/Update data based on employee id

    You need to format Column B as Text otherwise zero will be automatically deleted. Then when you write value to Sheet use the Format command to properly write the month number.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  14. #14
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: How to Add/Update data based on employee id

    Actually i am using userform and when i click the add button, the month value will be save like (01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11,12) format in column B
    Attached Files Attached Files

  15. #15
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,913

    Re: How to Add/Update data based on employee id

    Again, format column B as Text then use.

    Please Login or Register  to view this content.

  16. #16
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to Add/Update data based on employee id

    Or just leave the code the same and format column B as Custom "00"

+ 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. 2 Sets of Data, need to extract one cell based on employee name
    By kevingcp in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-21-2015, 01:39 PM
  2. Generate output employee data from input employee sheet
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2015, 05:28 PM
  3. [SOLVED] Gathering data from separate sheets based on employee name & date
    By avidcat in forum Excel General
    Replies: 14
    Last Post: 07-14-2014, 08:02 PM
  4. [SOLVED] Split excel data into multiple sheets based on Employee ID
    By Preeti1309 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-21-2014, 02:33 AM
  5. Summarize data selected on another sheet based on employee name entered
    By botoitchy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2013, 10:31 AM
  6. [SOLVED] Search for employee ID, based on Employee Name
    By MastahFez in forum Excel General
    Replies: 5
    Last Post: 04-16-2012, 02:35 PM
  7. moving rows of data based on employee name
    By losuite in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2010, 08:37 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