Clear contents

Aidan

Board Regular
Joined
May 14, 2004
Messages
120
Hi all,

I haven't been on for a while (and have forgotten all I have learned from this site) primarily because I haven't been using excel much in my work.

However I have been asked a question by a colleague and need a bit of help in answering it.

My colleague has devised a timesheet with the following columns

Column a = date
column b = da
column c = time in
column d = lunch start
column e = lunch end
column f = time out
column g = hours worked

Basically he is looking for a macro that will check that lunch start is greater than time in, if not then a message box appears saying wrong value and deletes the value in lunch start column.

I have had a quick search of the site but can't find anything that relevant. Your help, as always, would be much appreciated.

Regards


Aidan :biggrin:
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Hi Aidan

Just a thought, but wouldn't data validation be a better idea than a macro? It would be a lot simpler.

Richard
 

Aidan

Board Regular
Joined
May 14, 2004
Messages
120
Hi Richard,

thanks for that. As I said I don't use excel much now and if you don't use it you forget it quite quickly.

Another point about data validation. lunch start and lunch end must be greater than 30 mins. I have tried greater than d9+30 but doesn't like any of that.

Any ideas


Aidan
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Aidan

Validation Criteria:
1. Allow - "Time"
2. Data - "Greater Than"
3. Start Time - "=d9+30/1440"

works for me. 30/1440 is the portion of a whole day that 30 minutes represents.

Best regards

Richard
 

Forum statistics

Threads
1,136,512
Messages
5,676,289
Members
419,618
Latest member
Grisego

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top