Title: Excel Subroutine to Get the Left of Shape or difference between the left values of two
Shapes. Author: Amarpreet Singh
Copy the Code below this line:
--------------------------------------------------- Sub left_of_shape() 'By Amarpreet Singh
Dim ans As Double
Dim counter As Integer Dim msgTitle As String
msgTitle = "Left Values"
On Error GoTo ForOneOnly
' If Selection.Height Or Selection.Width > 0 Then ' counter = 1 ' End If With Selection counter = .Count End With If counter = 1 Then With Selection MsgBox "Left value is " & Round(.Left, 2), Title:=msgTitle ' CopyText Round(.Left, 2) End With ElseIf counter = 2 Then For Each obj In Selection ans = Abs(obj.Left - ans) Next MsgBox "Length is: " & Round(ans / 28.35, 2), Title:=msgTitle Else MsgBox "Select maximum two objects.", Title:=msgTitle End If Exit Sub ForOneOnly: With Selection MsgBox "Left value is " & Round(.Left, 2), Title:=msgTitle ' CopyText Round(.Left, 2) End With