how to use offset range and or resize

breilly00

Board Regular
Joined
Sep 15, 2008
Messages
53
Office Version
  1. 365
Platform
  1. Windows
I have a sheet that represents a score card for a sporting event. Row 3 contains the dates of the game, row 4 contains the day of the week and row 5 contains a ‘points’ heading. The remaining rows contain the scores of the games and the team name
For example.

  • Row 3 contains 01/01/19, 01/08,19, 01/15/19 etc. for 19 weeks
  • Row 4 contains Wed, Wed, Wed, etc.
  • Row 5 contains pts, pts, pts, pts, etc.
  • Row 6 thru 23 contains Team name (col1), Scores(col2 to end)
I am trying to copy certain columns to another spread sheet. The logic behind the copy is to take the current date search for a date greater than a date in row 3 and then copy the previous 3(smaller) dates and scores (rows 6 thru end). I can get the dates copied to another sheet by using the following
For Each mycell In Sheets("Scores").Range("B3", _
Sheets("Scores").Cells(3, LastCol))
If mycell.Value > LDate Then
Sheets("Scores").Range(mycell, mycell.Offset(0, -2)).Copy _
Destination:=Sheets("Standings").Range("H3"
Etc. etc

But, I am at a loss on how to move from the active cell in the date row down to row 6 and select the previous 3 columns and the rows (6-23) that contain the scores. The closest that I can is coping 1 column of scores to the different sheet using the following.
mycell.EntireColumn.Resize(Rows.Count - 5).Offset(5).Copy _
' Destination:=Sheets("standings").Range("H4")

A sample of my sheet is below. How would I search for a date, once found, copy the values and date to a new sheet for a total of 3 dates?
[TABLE="width: 557"]
<tbody>[TR]
[TD][/TD]
[TD]17-Sep
[/TD]
[TD]24-Sep
[/TD]
[TD]1-Oct
[/TD]
[TD]8-Oct
[/TD]
[TD]15-Oct
[/TD]
[TD]17-Oct
[/TD]
[TD]22-Oct
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Tuesday
[/TD]
[TD]Tuesday
[/TD]
[TD]Tuesday
[/TD]
[TD]Tuesday
[/TD]
[TD]Tuesday
[/TD]
[TD]Thursday
[/TD]
[TD]Tuesday
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pts
[/TD]
[TD]Pts
[/TD]
[TD]Pts
[/TD]
[TD]Pts
[/TD]
[TD]Pts
[/TD]
[TD]Pts
[/TD]
[TD]Pts
[/TD]
[/TR]
[TR]
[TD]1-Team Name
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]2-Team Name
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]3-Team Name
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]4-Team Name
[/TD]
[TD]2
[/TD]
[TD]x
[/TD]
[TD]1
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]2
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]5-Team Name
[/TD]
[TD]2
[/TD]
[TD]2
[/TD]
[TD]2
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]2
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
How about
Code:
mycell.offset(3,-3).resize(18,3).copy Sheets("Standings").Range("H3")
 
Upvote 0
Wow Wow Wow. I was looking all over the web to find out how to do this And, you with a single line of code showed me the light.

TY Very Much
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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