Restrict Cell Info

cityanangelstx2004

Board Regular
Joined
Jun 18, 2004
Messages
56
This is a two part question. I am working on a timesheet and I want to do the following.

A1 IN
B1 OUT
C1 IN
D1 OUT
E1 TOTAL

A2 8:00 am
B2 10:00 am
C2 11:00 am
D2 5:00 pm
E2 =((D4-A4+(D4 < A4))-(C4-B4+(C4 < B4)))*24


1. Is it possible using VBA to restrict a cell to only accept a date format and anything else would popup a message? So if someone entered a straight number 8 or text only then a message would appear and undo the incorrect entry.

2. How do you specify a formula for a specific cell using VBA? I know I can simply enter the code into the cell as referenced above, but I prefer to have that formula "=((D4-A4+(D4 < A4))-(C4-B4+(C4 < B4)))*24" be referenced for an entire range(e2:e14).

I appreciate any help on this subject. Thank you in advance. :confused:
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,221,241
Messages
6,158,737
Members
451,513
Latest member
EbenAgya

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
Back
Top