I need VBA code to copy data from grid schedules to teams worksheets

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Sorry, I don't download zip files !!
 
Upvote 0
Get updated file
https://1drv.ms/x/s!AnJwxxiz0Ezpg8dF8HyqCbYElYY9NA?e=L59Kff

TEAMS BY DIVISION picture 1
https://1drv.ms/u/s!AnJwxxiz0Ezpg8dKpFWcy9WXhBhGew


NFL GRID SCHEDULES picture 2
https://1drv.ms/u/s!AnJwxxiz0Ezpg8dLaKnNh9phKenbkw

BUFFALO BILLS picture 3
https://1drv.ms/u/s!AnJwxxiz0Ezpg8dMQRhD7km9SGPPmw

BUTTONS picture 4
https://1drv.ms/u/s!AnJwxxiz0Ezpg8dNCe1boslWb3tU8w

s!AnJwxxiz0Ezpg8dKpFWcy9WXhBhGew
s!AnJwxxiz0Ezpg8dLaKnNh9phKenbkw
s!AnJwxxiz0Ezpg8dMQRhD7km9SGPPmw
s!AnJwxxiz0Ezpg8dNCe1boslWb3tU8w

Thank You

Thomas
 
Last edited by a moderator:
Upvote 0
I need VBA code to copy data from grid schedules to teams worksheets
This should do that
Code:
Sub SchedToTeamSheets()
    
    Dim cel As Range, fndRng As Range
    Dim teamSht As Worksheet, teamName As String

For Each cel In Sheets("NFL GRID SCHEDULES").Range("B1:AG1")
    'the team sheet is the full name
    With Sheets("TEAMS BY DIVISION").UsedRange
        Set fndRng = .Find(What:=cel.Value, _
                           LookIn:=xlValues, _
                           LookAt:=xlWhole, _
                           SearchOrder:=xlByRows, _
                           SearchDirection:=xlNext, _
                           MatchCase:=False)
        teamName = fndRng.Offset(, 1).Value
        Set teamSht = Sheets(teamName)
    End With
    'copy cells to team sheet
    teamSht.Cells(1, "C").Resize(18).Value = cel.Offset(1).Resize(18).Value
Next cel
End Sub
 
Upvote 0
This should do that
Code:
Sub SchedToTeamSheets()
    
    Dim cel As Range, fndRng As Range
    Dim teamSht As Worksheet, teamName As String

For Each cel In Sheets("NFL GRID SCHEDULES").Range("B1:AG1")
    'the team sheet is the full name
    With Sheets("TEAMS BY DIVISION").UsedRange
        Set fndRng = .Find(What:=cel.Value, _
                           LookIn:=xlValues, _
                           LookAt:=xlWhole, _
                           SearchOrder:=xlByRows, _
                           SearchDirection:=xlNext, _
                           MatchCase:=False)
        teamName = fndRng.Offset(, 1).Value
        Set teamSht = Sheets(teamName)
    End With
    'copy cells to team sheet
    teamSht.Cells(1, "C").Resize(18).Value = cel.Offset(1).Resize(18).Value
Next cel
End Sub

Thanks You. I will put code on tomorrow and check it out.
 
Upvote 0
I have problem than I pres button stay PUT SCHEDULE INTO TEAMS WORKSHEETS

run-time error '91': Object varible or with block variable not set
teamName = fndRng.Offset(, 1).Value


Code:
Private Sub SCHEDULES_TO_TEAMS_SHEETS_Click() Dim cel As Range, fndRng As Range
    Dim teamSht As Worksheet, teamName As String


For Each cel In Sheets("NFL GRID SCHEDULES").Range("B1:AG1")
    'the team sheet is the full name
    With Sheets("TEAMS BY DIVISION").UsedRange
        Set fndRng = .Find(What:=cel.Value, _
                           LookIn:=xlValues, _
                           LookAt:=xlWhole, _
                           SearchOrder:=xlByRows, _
                           SearchDirection:=xlNext, _
                           MatchCase:=False)
        teamName = fndRng.Offset(, 1).Value
        Set teamSht = Sheets(teamName)
    End With
    'copy cells to team sheet
    teamSht.Cells(1, "C").Resize(18).Value = cel.Offset(1).Resize(18).Value
Next cel
End Sub


https://1drv.ms/x/s!AnJwxxiz0Ezpg8dhF4Q7MORL98Zj8Q?e=XDirnW


Thanks You

Thomas
s!AnJwxxiz0Ezpg8djOgMwlCwCEmYLCQ



s!AnJwxxiz0Ezpg8dU_Be-2v1KPEAk5g
 
Upvote 0
Team name abbreviations on NFL GRID SCHEDULES row one aren't all the same as TEAMS BY DIVISION abbreviations.
 
Upvote 0
How I change @JAX TO @JAC & @WSH TO WAS

try using finding replace say That function isn't vaild


Thanks you

Thomas
 
Upvote 0
try this
Code:
Sub Change_Abbrev()
Dim cel As Range
For Each cel In Sheets("NFL GRID SCHEDULES").UsedRange
    cel.Value = Replace(Replace(cel.Value, "JAX", "JAC"), "WSH", "WAS")
Next cel
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,943
Members
448,534
Latest member
benefuexx

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