+ Reply to Thread
Results 1 to 6 of 6

Paste Content from Row1 to Row2 above and update Row1

  1. #1
    Registered User
    Join Date
    02-15-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    17

    Paste Content from Row1 to Row2 above and update Row1

    Team, please let me start with a disclaimer that I don't have much VBA hands on Experience, but record excel macros sometimes to automate a few repetitive tasks or write small pieces of code to do simple tasks by reading through Google and forums like these.

    My Requirement and things I have done till now are below for your reference. I request for help if you could, please.
    Attached are two files [attachment]"Report_before.xls" [/attachment] & [attachment]"Report_After.xls"[/attachment] to show how the input and Output look like after I complete my Manual steps on the file.

    1) I have the input file [attachment] "Report_Before.xls" [/attachment] that has multiple rows. This data is basically the day wise work hours of the associates. Each Employee has two rows against his EMPlId (Column A). The first Row ( Resource Category : REGWK in Column B) has the Total work hours of the employee on every day of the month. The Second Row ( Resource Category: REGOT in Column B) is empty to start with and needs to be populated.

    2) For Every day of the month in Row 1 that has > 8 hours ( eg:10 hours), the row below for that associate should have difference of hours greater than 8 captured ( 10-8 = 2) - I am currently manually performing it on every second row using the if statement
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and for all days in the row. Basically these are the Overtime Hours above 8 hours worked by the associate on a particular day

    3) Once the Over time is calculated for all the EmpLIds, those extra hours need to be removed from the first row ( REGWK rows). I am currently doing this by filtering the Column B, selecting the Range and running a small macro to replace all hours greater than 8 hours by 8 hours.

    Please Login or Register  to view this content.

    The Final Output looks like the [attachment] Report_After.xls [/attachment]

    I would appreciate any help in automating the first part of this work, where I am manually doing the If Statement to calculate the Over Time.
    Attached Files Attached Files
    Last edited by sshishirkumar; 09-02-2020 at 05:25 AM. Reason: Code Tagging

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: Paste Content from Row1 to Row2 above and update Row1

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-15-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Paste Content from Row1 to Row2 above and update Row1

    Thanks admin. I have done code tagging as much as I could.
    Please let me know for any concerns.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Paste Content from Row1 to Row2 above and update Row1

    One way I suppose...
    Please Login or Register  to view this content.
    EDIT...Only now noticed If more than 8 hours...Code has been amended...
    Last edited by sintek; 09-02-2020 at 08:15 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Registered User
    Join Date
    02-15-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Paste Content from Row1 to Row2 above and update Row1

    Thanks a lot for your help. This not only helped me in getting my issue resolved. I have also learnt abut the offset function and how it should be used. Hope full I will try out other scenarios in the future myself and contribute to others as well, as much as I can.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Paste Content from Row1 to Row2 above and update Row1

    Glad I could assist..Tx for rep +

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Using COUNTA in row 2 with a range in Row1
    By jshartig in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-05-2014, 02:50 PM
  2. [SOLVED] How do I count number of values in row2 that doesn't exist in row1?
    By viking2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2013, 04:11 AM
  3. Replies: 6
    Last Post: 08-22-2012, 07:53 AM
  4. Delete Row1
    By RAparente in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2008, 03:16 AM
  5. Paste formats from row1 to all rows with data
    By Portuga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-03-2008, 05:02 PM
  6. Lookup by text in Row1?
    By soundengineer in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-19-2007, 07:46 PM
  7. VB Code is working for row1; how to apply to row2?
    By moike in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2006, 02:50 PM
  8. [SOLVED] VBA to Identify changes in row1
    By Edmund in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2006, 01:45 AM

Tags for this Thread

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