#### Bohica

##### New Member
Hi all,

I have a problem with my timesheet. I need it to round up and down in 15 minute increments. I have been able to create it using this message board (yes I just borrowed your brilliance) and I'm sure there's an easy way to do this but since I don't understand it I can't fix it. I have borrowed a vb code to get me started and in each cell there is a formula to enter and calculate the time automatically by double clicking. So here you go and btw Thanks.

This is the code I borrowed:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Count > 1 Then Exit Sub
If Target.Row < 7 Or Target.Row > 12 Then Exit Sub
If Target.Column < 3 Or Target.Column > 6 Then Exit Sub
Application.EnableEvents = False
Target.Value = Time
Application.EnableEvents = True

End Sub

Each cell in the daily total column is the following:

=((F7-C7+(F7<C7))-(E7-D7+(E7<D7)))*24

In the weekly total column the formula is basic:

=SUM(G7:H11)

All of which work awesome!!! Except for the 15 minutes rounding.

Bohica

### Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Is it?

Target.Value = Round(Time * 96, 0) / 96

If yer in such a toot fer an answers, ya might try doin' a search! :wink:

The very first thread returned by search for "round times 15 minutes" returned this:

http://www.mrexcel.com/board2/viewtopic.php?p=1110315#1110315

from Denis (SydneyGeek) which you should be able to apply to your code. (At least give it a shot before you ask someone else to try.)

<sup>edit</sup> Mr. Poulsom, you are so much nicer than me! (And obviously a quicker typist!) <sub>/edit</sub>

Replies
1
Views
206
Replies
50
Views
2K
Replies
23
Views
1K
Replies
3
Views
471
Replies
1
Views
498

1,217,384
Messages
6,136,274
Members
450,001
Latest member
KWeekley08

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back