Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub zzzzzzzzzzzzz()
Dim strTest As String, a As Long, arrStr() As String, arrLng() As Long
strTest = "Garbage(-338409,-110472,8275)"
a = InStr(1, strTest, "(")
If a <> 0 Then
strTest = Right(strTest, Len(strTest) - a)
End If
a = InStr(1, strTest, ")")
If a <> 0 Then
strTest = Left(strTest, a - 1)
End If
arrStr = Split(strTest, ",")
arrLng = ConvertArray_Long(arrStr())
End Sub
Function ConvertArray_Long(arrVar)
Dim i As Long, arrTmp() As Long
ReDim arrTmp(LBound(arrVar) To UBound(arrVar))
For i = LBound(arrVar) To UBound(arrVar)
arrTmp(i) = Val(arrVar(i))
Next i
ConvertArray_Long = arrTmp()
End Function
Sub EnterValuesAndCalcsPlease()
Dim c As Range, rngLoop As Range
Dim strTest As String, a As Long, n As Long
Dim arrStr() As String, arrLng() As Long
Call SpeedUp
On Error GoTo ErrEnd
Set rngLoop = Range("B4", Cells(Rows.Count, 2).End(xlUp))
For Each c In rngLoop
strTest = c.Value
If strTest Like "*(*,*)" Then
arrStr = Split(Replace(Mid(strTest, InStrRev(strTest, "(") + 1), ")", ""), ",")
arrLng = ConvertArray_Long(arrStr())
Range("C" & c.Row).Value = arrLng(0)
Range("D" & c.Row).Value = arrLng(1)
Range("E" & c.Row).Value = arrLng(2)
Range("H" & c.Row).Formula = "=SQRT(($C$2-C" & c.Row & ")+($D$2-D" & c.Row & ")+($E$2-E" & c.Row & "))"
End If
Next c
ErrEnd:
Call SpeedDown
End Sub
Function ConvertArray_Long(arrVar)
Dim i As Long, arrTmp() As Long
ReDim arrTmp(LBound(arrVar) To UBound(arrVar))
For i = LBound(arrVar) To UBound(arrVar)
arrTmp(i) = Val(arrVar(i))
Next i
ConvertArray_Long = arrTmp()
End Function
Sub SpeedUp()
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.ScreenUpdating = False
End Sub
Sub SpeedDown()
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.StatusBar = False
End Sub