How to pull entire row data from 1 sheet to another ONLY if a cell in row is from this week

samnz

New Member
Joined
Nov 21, 2013
Messages
8
Creating a Sport Draws & Results spreadsheet.

The first sheet is "This Week" while following sheets are "Netball", "Football" etc. In a sport sheet there are rows of data that contain the team, date, time, opposition, location, and results. See below:

1st XV BoysWed
14-Aug7 pmvDilworthHomeField 7Quarterfinal23v8win

<tbody>
</tbody>

There would be a large number of rows in a sport sheet as would contain all the teams within that sport, and all the games for that year.


How can I pull content from a sport sheet into "This Week" sheet, ONLY if the date is within the current week?


So "This Week" sheet would be a list of all teams and all sports playing in the current week...

Football
1st XV BoysSat
17-Aug7 pmvDilworthHomeField 7Final23v8win

<tbody>
</tbody>

2nd XV BoysSat
17-Aug8 pmvDilworthDilworthField 7Finalv

<tbody>
</tbody>

Netball
Premier Girls
Sat
17-Aug9 pmvAuckland GrammarAuckland GrammarCourt 9
Semifinalv

<tbody>
</tbody>

Senior A Girls

<tbody>
</tbody>

Happy for there to be no content sitting alongside a Teams name in "This Week" if there is no row with the current week. i.e. Senior A Girls under Netball left blank
 
Last edited:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
See if this is close. This code should be copied into the standard code module 1. To access the code module, press Alt + F11. You will need to ensure that macros are enabled and access to VBA has been established. The workbook which hosts the code must be saved as a macro enabled workbook if your Excel version is 2007 or later.
Code:
Sub sports()
Dim sh As Worksheet, lr As Long
Set sh = Sheets(1)
x = Application.WeekNum(Date)
    For p = 2 To 5 'Assumes sports sheets are 2 thru 5
        lr = Sheets(p).Cells(Rows.Count, 3).End(xlUp).Row
        For i = 2 To lr
            If x = Application.WeekNum(Sheets(p).Range("C" & i).Value) Then
                 Sheets(p).Rows(i).Copy sh.Cells(Rows.Count, 1).End(xlUp)(2)
            End If
        Next
    Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,992
Members
449,094
Latest member
masterms

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