Macro Help

Pumper

Board Regular
Joined
Sep 12, 2013
Messages
95
Office Version
  1. 2016
Hi Everyone,

I am trying to update my macro so the data in column B (tab name “Checks”) is copied to another tab (“DATA”) into column B also. What I need is for that same data to be cut and pasted 3 times on a Monday when I run it (so it’s the same numbers for Fri/Sat/Sun) once every other day.

Any help is much appreciated

 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
This could probably be a little more concise but it should get the job done.

Code:
[COLOR=#0000ff]Sub[/COLOR] CopyBasedOnDate()


    [COLOR=#0000ff]Dim[/COLOR] TodaysDate    [COLOR=#0000ff]As Integer[/COLOR]
   [COLOR=#0000ff] Dim[/COLOR] CheckLastrow  [COLOR=#0000ff]As Integer[/COLOR]
    [COLOR=#0000ff]Dim[/COLOR] DataLastRow   [COLOR=#0000ff]As Integer[/COLOR]
   [COLOR=#0000ff] Dim[/COLOR] i             [COLOR=#0000ff]As Integer[/COLOR]
    
    TodaysDate = Weekday(Date, vbMonday)[COLOR=#008000] 'Determine the Day of Week, 1 = Monday[/COLOR]
  [COLOR=#0000ff]  If [/COLOR]TodaysDate = 1 [COLOR=#0000ff]Then[/COLOR]
    
       [COLOR=#0000ff] For[/COLOR] i = 1 [COLOR=#0000ff]To[/COLOR] 3 [COLOR=#0000ff]Step[/COLOR] 1
            CheckLastrow = Sheets("Checks").Range("B" & Rows.Count).End(xlUp).Row
            Sheets("Checks").Range("B1:B" & CheckLastrow).Copy
            DataLastRow = Sheets("Data").Range("B" & Rows.Count).End(xlUp).Row
            Sheets("Data").Range("B" & DataLastRow + 1).Select
            ActiveSheet.Paste
        [COLOR=#0000ff] Next [/COLOR]i
    
[COLOR=#0000ff]           Else
[/COLOR]  
        CheckLastrow = Sheets("Checks").Range("B" & Rows.Count).End(xlUp).Row
        Range("B1:B" & CheckLastrow).Copy
        DataLastRow = Sheets("Data").Range("B" & Rows.Count).End(xlUp).Row
        Sheets("Data").Range("B" & DataLastRow + 1).Select
        ActiveSheet.Paste


[COLOR=#0000ff]    End If[/COLOR]

[COLOR=#0000ff]End Sub[/COLOR]
 
Upvote 0
Thanks for your help mrmmickle1

That is enough for me to work with, appreciate your time and effort

 
Upvote 0

Forum statistics

Threads
1,212,096
Messages
6,105,940
Members
447,985
Latest member
gigi11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top