Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi All,
I have the following piece of code that will round value (positive and negative values) to the nearest 0.5:
For i = 33 To 35
With Sheets(1).Cells(i, 14)
If .Value <> "" Then
.Value = Application.MRound(.Value, Sgn(.Value) * 0.5)
End If
End With
Next
For i = 12 To 21
With Sheets(1).Cells(i, 17)
If .Value <> "" Then
.Value = Application.MRound(.Value, Sgn(.Value) * 0.5)
End If
End With
Next
For i = 12 To 24
With Sheets(1).Cells(i, 19)
If .Value <> "" Then
.Value = Application.MRound(.Value, Sgn(.Value) * 0.5)
End If
End With
Next
I have it set up for a few different cell ranges so I have two question:
1) is it possible to combine these rather than having multiples
2) I want to have an error that appears so if a user enters a range of values into the cell (17-25 for example)
they are prompted to enter a single number and when they select OK the cell will be reselected
I hope you are able to help out.
Thanks in advance,
Mike
I have the following piece of code that will round value (positive and negative values) to the nearest 0.5:
For i = 33 To 35
With Sheets(1).Cells(i, 14)
If .Value <> "" Then
.Value = Application.MRound(.Value, Sgn(.Value) * 0.5)
End If
End With
Next
For i = 12 To 21
With Sheets(1).Cells(i, 17)
If .Value <> "" Then
.Value = Application.MRound(.Value, Sgn(.Value) * 0.5)
End If
End With
Next
For i = 12 To 24
With Sheets(1).Cells(i, 19)
If .Value <> "" Then
.Value = Application.MRound(.Value, Sgn(.Value) * 0.5)
End If
End With
Next
I have it set up for a few different cell ranges so I have two question:
1) is it possible to combine these rather than having multiples
2) I want to have an error that appears so if a user enters a range of values into the cell (17-25 for example)
they are prompted to enter a single number and when they select OK the cell will be reselected
I hope you are able to help out.
Thanks in advance,
Mike