Hey Guys,
I was wondering if you might be able to help me. I have been all over the web pulling my hair out on this one.
It seems I can't find an informative answer on this. They all just seem to list code that does the job, but doesn't explain how it works.
Goal:
Grab data from sheet 1 that is listed horizontally and paste that information in sheet 2 vertically.
FROM: (SHEET 1)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]WEEK[/TD]
[TD]TEAM1[/TD]
[TD]TEAM2[/TD]
[TD]TEAM3[/TD]
[TD]TEAM4[/TD]
[TD]TEAM5[/TD]
[TD]TEAM6[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]40[/TD]
[TD]50[/TD]
[TD]60[/TD]
[TD][/TD]
[TD]80[/TD]
[TD]90[/TD]
[/TR]
</tbody>[/TABLE]
TO: (SHEET 2)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]WEEK[/TD]
[TD]TEAM[/TD]
[TD]SCORE[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]TEAM1[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]TEAM2[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]TEAM3[/TD]
[TD]60[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][/TD]
[TD]TEAM5[/TD]
[TD]80[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD]TEAM6[/TD]
[TD]90[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
If you notice above it omitted Team4 completely since there was no score for that week for that team.
I am aware that I have to have a Multidimensional array and use a loop to gather both the heading data (Team1-6) and the score data.
Here is my code so far:
Any help would be great as the web has turned out to be very vague in explaining Arrays and using Loops with them.
later
Ty
I was wondering if you might be able to help me. I have been all over the web pulling my hair out on this one.
It seems I can't find an informative answer on this. They all just seem to list code that does the job, but doesn't explain how it works.
Goal:
Grab data from sheet 1 that is listed horizontally and paste that information in sheet 2 vertically.
FROM: (SHEET 1)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]WEEK[/TD]
[TD]TEAM1[/TD]
[TD]TEAM2[/TD]
[TD]TEAM3[/TD]
[TD]TEAM4[/TD]
[TD]TEAM5[/TD]
[TD]TEAM6[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]40[/TD]
[TD]50[/TD]
[TD]60[/TD]
[TD][/TD]
[TD]80[/TD]
[TD]90[/TD]
[/TR]
</tbody>[/TABLE]
TO: (SHEET 2)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]WEEK[/TD]
[TD]TEAM[/TD]
[TD]SCORE[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]TEAM1[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]TEAM2[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]TEAM3[/TD]
[TD]60[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][/TD]
[TD]TEAM5[/TD]
[TD]80[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD]TEAM6[/TD]
[TD]90[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
If you notice above it omitted Team4 completely since there was no score for that week for that team.
I am aware that I have to have a Multidimensional array and use a loop to gather both the heading data (Team1-6) and the score data.
Here is my code so far:
Code:
Option Explicit
Sub FormatScores()
Dim TeamCount as Integer
Dim TeamScore as Integer
Dim VarTeamScore(6,6) As Variant
For TeamCount 0 to 6
VarTeamScore(TeamCount) = Range(cells(1, TeamCount).value
VarTeamScore(ScoreCount) = Range(cells(1, ScoreCount).Value
TeamCount = TeamCount + 1
ScoreCount = ScoreCount + 1
Next
End Sub
Any help would be great as the web has turned out to be very vague in explaining Arrays and using Loops with them.
later
Ty
Last edited: