if the VBA is correct, below is the modification:
' Find the smallest closest rebar size
For Each smalest In rebars
If smalest < crosssection And smalest > Fix(crosssection) Then
result.Add smalest, smalest & " - " & rebars(smalest)
End If
Next smalest
' Find the closest rebar size
For Each closestRebar In rebars
If crosssection <= closestRebar And closestRebar < Round(crosssection + 2, 0) Then
result.Add closestRebar, closestRebar & " - " & rebars(closestRebar)
End If
Next closestRebar
' Print the results
If result.Count > 0 Then
MsgBox "Rebar results: " & crosssection & vbCrLf & Join(result.Items, vbCrLf)
Else
MsgBox "Rebars not available. Check input: " & crosssection
End If