+ Reply to Thread
Results 1 to 8 of 8

Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

  1. #1
    Registered User
    Join Date
    07-15-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    77

    Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    Hi All

    I have a 'rota' worksheet that includes staff names and their rostered hours on all dates through the month.

    On each date of the month I need excel to find that date in column A and then look across the row to find any cells that aren't blank. When the cell has a value I need the name above it in row 1 and the value (number of hours) itself to copy across to a 'daily activities' sheet. The date is autopopulating on this sheet in cell H5.

    The name needs to drop into column A and the hours worked into column B. I would like the first cell to be A9 and then down from there with no spaces in between names. The other info on the sheet will then complete itself using the name that has been dropped in using VLookup.

    I'm presuming I can use a macro to do this for me but am really struggling where to start with it, and how to ignore blank cells as they will change cells on a monthly basis.

    Sample.xlsm

    Thanks in advance
    Mark
    Last edited by markrennolds; 11-12-2009 at 06:51 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    Can you unlock the sheet please. (NVM, I just copied the sheets to a new workbook.)

    Also, are you averse to switching the ROTA table so the names are down the left and dates across the top...a more standard layout and easier to read?

    Will there always be only one DAILY ACTIVITIES SHEET at a time? If so, this would be simple to add an indexing column/row to the ROTAS sheet to make transfer to the DAILY sheet a breeze.
    Last edited by JBeaucaire; 11-11-2009 at 04:31 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-15-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    Hi

    Yes there will only be one daily activities sheet, which updates daily with new people working each day. If I need to alter rota tab that will be fine, will just involve changing some formulas around on other tabs.

    I have attached unlocked sheet.

    Sample.xlsm

    Thanks
    Mark

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    If you run this macro from the DAILY ACTIVITIES sheet, it will put the names and hours into column A:B
    Please Login or Register  to view this content.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].

  6. #6
    Registered User
    Join Date
    07-15-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    Hi

    This worked initially yesterday but is not working today. It appears to be looking at the wrong date but I cant see why. I have re-attached the sheet. Eventually I will need this macro to work in excel 97 as office software is older version. However it is only letting me attach to this site in this format.

    Sample.xlsm

    Thanks
    Mark

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    My bad. Change this line:
    Please Login or Register  to view this content.
    Does that solve it?

    I noticed the name change for code author in your posted sheet.
    Last edited by JBeaucaire; 11-12-2009 at 11:05 AM.

  8. #8
    Registered User
    Join Date
    07-15-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Macro To Find Positive Value In One Cell Then Copy Value Of Corresponding Cells

    Apologies, didnt know what it meant. Thank you for all your help. All works well now.

    Mark

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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