+ Reply to Thread
Results 1 to 8 of 8

Help to transfer data from one sheet to another

  1. #1
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Help to transfer data from one sheet to another

    Hi All

    I am hoping that you can help me find a macro for the following, to help make a long process nice and simple. I need to be able to take data from one sheet and copy and paste it to another - but with a catch. the first sheet contains a list of names and the days of the week (Monday to Sunday) against each name is the person availability with unavailable days enter as an 'U'.

    What I would like to be able to do is take this information and copy it across to another sheet which lists all the same names and the days they are unavailable for the following six months. in a ideal world when this information is copied across only the 'U' would be copied across and any data already entered onto the calendar would be left in place and not overwritten (is this last bit possible?)

    Thanks for any help you will be able to give

    Chris
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by C J W; 02-11-2017 at 01:03 PM. Reason: Added attachment

  2. #2
    Valued Forum Contributor Maudibe's Avatar
    Join Date
    12-21-2016
    Location
    USA
    MS-Off Ver
    2010-2013
    Posts
    326

    Re: Help to transfer data from one sheet to another

    Hi CJ,

    Consider this code that allows the user to select the days unavailable ("U") on the Details sheet for a person. The person's schedule on the Availability sheet will automatically be updated as the user enters the data. Unavailable days will be transferred across while not overwriting data if it exists. Removing an unavailable day on the Details sheet will remove all the unavailability's for that weekday across the board for that person. Also added is the conditional formatting on both sheets.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Maudibe; 02-10-2017 at 09:47 PM.

  3. #3
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Re: Help to transfer data from one sheet to another

    Thank you - that is very clever just what I was after. (I would have never gotten that!) Although is it possible when checking what day of the week it is that instead of using "Mon", "Tue" as the reference ,can we use the value from a formula, as ideally the availability sheet will use a formula (weekday) to show what day of the week it is.

    Thanks again

  4. #4
    Valued Forum Contributor Maudibe's Avatar
    Join Date
    12-21-2016
    Location
    USA
    MS-Off Ver
    2010-2013
    Posts
    326

    Re: Help to transfer data from one sheet to another

    Sure, change the following line in the code:

    Please Login or Register  to view this content.
    Maud

  5. #5
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Re: Help to transfer data from one sheet to another

    thanks for the quick reply, I have replaced the line of code and amended the datasheet to the formats I need to use, but I get a debug error. I have attached a copy of what I have done - can you advise?

    thanks once again.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Maudibe's Avatar
    Join Date
    12-21-2016
    Location
    USA
    MS-Off Ver
    2010-2013
    Posts
    326

    Re: Help to transfer data from one sheet to another

    CJ,

    On the Availability sheet, the header was changed to formulas and formats. Row 1 header used to be the days of the week (Sun, Mon, Tue, etc.) and is now converted to a date (1/1/2017, 1/2/2107, etc.) which displays a weekday with a "ddd" format. So when the code searches for "Sun", it can't find it (ERROR). Rows 2,3,and 4 are different formats of row 1 to show the day ("dd"), month ("mmm"), and the year ("yyyy").

    To correct the problem, replace row 1 with the text of the weekdays ("Mon", "Tue", etc) going across. In row 2 you can enter the full date starting at 1/1/2017 like you did in row 1 and drag across. Since it is formatted as "dd", it will appear as you want. Now have header rows 3 and 4 equal to row 2 (instead of 1) and they will appear as you formatted them.

    So essentially, row 1 is texted weekdays and rows 2-4 are formatted rows the equals the date in row 2. Since rows 2-4 are not used in the search, their formats/formulas are irrelevant

    ...is it possible when checking what day of the week it is that instead of using "Mon", "Tue" as the reference ,can we use the value from a formula?
    the changed formula, AvailDay = Choose(Weekday(date), "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat") was entered in the code literally. "date" must be replaced by a value, variable, or cell that evaluates to some date. If you leave the word date, it will be interpreted as Date function which will always be the current date and the formula will output the weekday of the current date. Tomorrow it will be different

    The reason that I wrote the code they way I originally did was so that whatever weekday that you marked as unavailable for a person on the Details sheet would carry over and mark all that weekdays unavailable on the Availability sheet throughout the year. With the new change, if the weekday is not evaluated by the column you entered the "U", the code will act independently of which column you entered and use a date that you sent to macro. So if you select a "Mon" on the Details sheet, the code may mark every "Sat" on the Availability sheet because that what was sent to the code

    I hope that explains it better. If these are must have changes, then I am willing to help you further. Please give me more detail on how the date (weekday) formula will be determined and sent to the macro.

    Maud

  7. #7
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Re: Help to transfer data from one sheet to another

    thank for explanation - you've been more than helpful and what you have provided will work great.

  8. #8
    Registered User
    Join Date
    02-09-2017
    Location
    UK
    MS-Off Ver
    2019
    Posts
    59

    Re: Help to transfer data from one sheet to another

    I have posted a follow up to this original query here:

    Please Login or Register  to view this content.
    Last edited by C J W; 02-12-2017 at 07:44 PM. Reason: Corrected tag use

+ 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] Issue regarding recorded Macro to transfer data from Input sheet to Storage sheet
    By Hirad001 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-29-2015, 04:26 PM
  2. Replies: 5
    Last Post: 12-30-2014, 12:41 PM
  3. Transfer data from input sheet to data sheet by using command button
    By vinh1985 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2014, 12:17 AM
  4. Replies: 5
    Last Post: 02-09-2014, 08:29 PM
  5. How to transfer data from a daily input sheet to a separate monthly total sheet
    By Jcooper71 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2014, 02:37 PM
  6. Replies: 1
    Last Post: 03-11-2013, 05:37 AM
  7. Replies: 1
    Last Post: 02-13-2013, 01:32 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