Hello,
the idea is to center an image in the middle of a cell where the cell's size is variable. This shall be done for a column of images if a certain cell in the same row contains content different from 0. If not the image shall be invisible.
Can you please help me to identify the problem here:
Sub Center()
Private Sub CenterMe(Shp As shape, OverCells As Range)
Thank you =)
the idea is to center an image in the middle of a cell where the cell's size is variable. This shall be done for a column of images if a certain cell in the same row contains content different from 0. If not the image shall be invisible.
Can you please help me to identify the problem here:
Sub Center()
Dim Position As Integer
Dim Picture As Integer
Picture = 6
For Position = 7 To 320
Dim Picture As Integer
Picture = 6
For Position = 7 To 320
If Sheets("List of Measures").Cells(Position, 2).Value = "" Then
Sheets("List of Measures").Shapes(Picture).Visible = msoFalse
Else
Call CenterMe(Sheets("List of Measures").Shapes(Picture), Sheets("List of Measures").Range(Cells(Position, 9)))
Picture = Picture + 1
End If
End If
Next Position
End SubPrivate Sub CenterMe(Shp As shape, OverCells As Range)
With OverCells
Shp.Left = .Left + ((.Width - Shp.Width) / 2)
Shp.Top = .Top + ((.Height - Shp.Height) / 2)
End With
End SubThank you =)