, - ( 1), - 2; % complete.
Note. It must be adjusted to offset the part of the form of the text field, which is located to the left of the arrow head.
Option Explicit
Public Sub movebox()
Dim textbox As Shape, progbar As Shape
Dim ws As Worksheet
Dim stp As Integer, endp As Integer
Dim tbdyn As Integer
Dim mn As Double, mx As Double, actper As Double, cur As Double
Dim admn As Double, admx As Double
Set ws = Sheets("sheet1")
Set progbar = ws.Shapes(1)
Set textbox = ws.Shapes(2)
'// Far left of progress bar position
stp = progbar.Left
'
endp = (progbar.Width + stp)
'// Adjust for starting at 0.51
'
'// from the appropriate cells on the spreadsheet
mn = 0.51
mx = 6.07
admn = 0
admx = 6.07 - mn
cur = 4
'
actper = cur / admx
'// Apply percentage to progress bar
tbdyn = actper * endp
'
textbox.Left = tbdyn
End Sub
source
share