M
Max
Hello All,
Below is some code written by Bernie Dietricka and adapted by someone else
here on this forum.
I have tred to change it myself to achieve the following.
I have two columns of teams, that play each other on a home and away basis.
I have the club badges in the column next to there club name.
The club names are in range D613 for the home teams in both rounds.
The Away teams in the range G6:G13.
At present the badges are showing in the correct column for the away teams,
but not for the Home teams.
For the home teams the badges are staying in the same sequence as the away
team names.
Could you please help and rectify my error.
Option Explicit
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Dim oPic2 As Picture
Dim rCell As Range
Me.Pictures.Visible = True
For Each rCell In Range("D613, G6:G13").Cells
With rCell
Set oPic = Me.Pictures(Replace(.Text & "", " ", ""))
oPic.Visible = True
oPic.Top = .Top + .Height / 1.4 - oPic.Height / 1.4
oPic.Left = .Offset(0, -2).Left + .Offset(0, -2).Width / 2 -
oPic.Width / 2
Set oPic2 = Me.Pictures(Replace(.Text & "2", " ", ""))
oPic2.Visible = True
oPic2.Top = .Top + .Height / 1.4 - oPic2.Height / 1.4
oPic2.Left = .Offset(0, 1).Left + .Offset(0, 1).Width / 2 -
oPic2.Width / 2
End With
Next rCell
End Sub
Thank you and best regards
Max
Below is some code written by Bernie Dietricka and adapted by someone else
here on this forum.
I have tred to change it myself to achieve the following.
I have two columns of teams, that play each other on a home and away basis.
I have the club badges in the column next to there club name.
The club names are in range D613 for the home teams in both rounds.
The Away teams in the range G6:G13.
At present the badges are showing in the correct column for the away teams,
but not for the Home teams.
For the home teams the badges are staying in the same sequence as the away
team names.
Could you please help and rectify my error.
Option Explicit
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Dim oPic2 As Picture
Dim rCell As Range
Me.Pictures.Visible = True
For Each rCell In Range("D613, G6:G13").Cells
With rCell
Set oPic = Me.Pictures(Replace(.Text & "", " ", ""))
oPic.Visible = True
oPic.Top = .Top + .Height / 1.4 - oPic.Height / 1.4
oPic.Left = .Offset(0, -2).Left + .Offset(0, -2).Width / 2 -
oPic.Width / 2
Set oPic2 = Me.Pictures(Replace(.Text & "2", " ", ""))
oPic2.Visible = True
oPic2.Top = .Top + .Height / 1.4 - oPic2.Height / 1.4
oPic2.Left = .Offset(0, 1).Left + .Offset(0, 1).Width / 2 -
oPic2.Width / 2
End With
Next rCell
End Sub
Thank you and best regards
Max