Results 1 to 2 of 2

Thread: VBA - Copy Paste in last workday
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    May 2018
    Posts
    66
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default VBA - Copy Paste in last workday

    Hello everybody!


    I'm currently facing a relatively simple problem.
    I have the following table:
    There are values in the Range B2:F2
    Then there are a calender column since A5 - like below

    A B C D E F
    100 150 20 70 50
    01.01.2019
    02.01.2019
    03.01.2019
    04.01.2019
    05.01.2019


    Now I just want to copy the values from B2:F2 in the respective row (Bx:Fx) with the date of yesteray - but just for a workday.
    When today is mondey it should copy the values in friday.


    Does anyone how to manage that?

    Best Regards
    Last edited by joslaz; Jul 10th, 2019 at 01:01 PM.

  2. #2
    Board Regular
    Join Date
    Sep 2016
    Posts
    2,574
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    1 Thread(s)

    Default Re: VBA - Copy Paste in last workday

    Code:
    Dim d As Range: Set d = [A:A].Find(CDate([WORKDAY(TODAY(),-1)]))
    If Not d Is Nothing Then [B2:F2].Copy d(1, 2)
    Last edited by footoo; Jul 10th, 2019 at 11:20 PM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •