Just a matter of changing strings to numbers and sharing variables
Option Explicit
Dim PH As Single, PW As Single, TR As Single, BR As Single
Dim LR As Single, RR As Single, MB As Single, ES As Single
Dim RD As Single, TWOM As Single
Private Sub CommandButton1_Click()
Call Fractions
TotalMattingOpeningHeight = PH + TR + BR
TotalMattingOpeningWidth = PW + LR + RR
TotalInsideFrameHeight = PH + TR + BR + (MB * 2) + (ES * 2)
TotalInsideFrameWidth = PW + LR + RR + (MB * 2) + (ES * 2)
TotalCuttingHeight = PH + TR + BR + (MB * 2) + (ES * 2) + ((TWOM * 2 - RD) * 2)
TotalCuttingWidth = PW + LR + RR + (MB * 2) + (ES * 2) + ((TWOM * 2 - RD) * 2)
End Sub
Sub Fractions()
PH = Convert(PaintingHeight)
PW = Convert(PaintingWidth)
TR = Convert(TopReveal)
BR = Convert(BottomReveal)
LR = Convert(LeftReveal)
RR = Convert(RightReveal)
MB = Convert(MattingBorder)
ES = Convert(ExpansionSpace)
RD = Convert(DepthOfRabbet)
End Sub
Function Convert(x)
Dim Dim1, Dim2
If InStr(1, x, " ") Then
If InStr(1, x, "/") Then
Dim1 = Split(x)(0)
Dim2 = Split(Split(x)(1), "/")(0) / Split(Split(x)(1), "/")(1)
Convert = Trim(Dim1 + Dim2)
Else
Convert = Trim(x)
End If
Else
If InStr(1, x, "/") Then
Dim2 = Split(x, "/")(0) / Split(x, "/")(1)
Convert = Trim(Dim2)
Else
Convert = Trim(x)
End If
End If
End Function
Private Sub ResetButton_Click()
Unload UserForm1
UserForm1.Show
End Sub
Private Sub QuitButton_Click()
UserForm1.Hide
End Sub