Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Sub ImageClick()
  2. Dim shp As Shape
  3. Dim big As Single, small As Single
  4. Dim shpDouH As Double, shpDouOriH As Double
  5. big = 3
  6. small = 1
  7.  
  8. 'On Error Resume Next
  9. Set shp = ActiveSheet.Shapes(Application.Caller)
  10. With shp
  11. shpDouH = .Height
  12. .ScaleHeight 1, msoTrue, msoScaleFromTopLeft
  13. shpDouOriH = .Height
  14.  
  15. If Round(shpDouH / shpDouOriH, 2) = big Then
  16. .ScaleHeight small, msoTrue, msoScaleFromTopLeft
  17. .ScaleWidth small, msoTrue, msoScaleFromTopLeft
  18. .ZOrder msoSendToBack
  19. Else
  20. .ScaleHeight big, msoTrue, msoScaleFromTopLeft
  21. .ScaleWidth big, msoTrue, msoScaleFromTopLeft
  22. .ZOrder msoBringToFront
  23. End If
  24. End With
  25.  
  26. End Sub
  27.  
  28. ''''''''''''''''''''''''''''''''''''''''''''''''''''
  29.  
  30. Private Sub Worksheet_Activate()
  31.  
  32. Dim image As Shape
  33. Dim suffix As String
  34. Dim counter As Long
  35. counter = 1
  36.  
  37. For Each image In ActiveSheet.Shapes
  38. suffix = "r!" + Format(counter, "00000")
  39. If Not InStr(image.Name, "r!") Then
  40. image.Name = image.Name + suffix
  41. End If
  42. counter = counter + 1
  43. Next image
  44.  
  45. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement