[vba] [vba] 사진(이미지) 클릭시 확대 / 축소하기
익명
2019-09-29 22:19
3,526
0
본문
Sub PictureToggleZoom()
Dim P As Picture, C As Range, V As Variant
Set P = ActiveSheet.Pictures(Application.Caller)
P.ShapeRange.ZOrder msoBringToFront
P.ShapeRange.LockAspectRatio = msoTrue
If InStr(P.Name, "TogglePicture") = 0 Then _
P.Name = Join(Array("TogglePicture", P.TopLeftCell.Address(0, 0), False))
V = Split(P.Name)
Set C = Range(V(1))
V(2) = Not V(2)
If V(2) Then
P.Width = C.Width * 5
P.Left = P.Left - (P.Width - C.Width)
Else
P.Width = C.Width
P.Left = C.Left
End If
P.Name = Join(V)
End Sub
댓글목록0