Data Validation - Minutes
|
Original Message
|
Name: gillywilly
Date: September 20, 2007 at 05:02:57 Pacific
Subject: Data Validation - MinutesOS: Office XPCPU/Ram: N/AModel/Manufacturer: Office |
Comment: does anyone know how i can set up data validation in Excel XP so that people can only input a figure in minutes? with a maximum of 60 minutes being allowed (this is for lunchtime)
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Jennifer SUMN
Date: September 20, 2007 at 06:30:56 Pacific
Subject: Data Validation - Minutes |
Reply: (edit)I'm no longer using Office 2002, but isn't there an option under Data to select Validation? Life's more painless for the brainless.
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: DerbyDad03
Date: September 20, 2007 at 08:07:32 Pacific
Subject: Data Validation - Minutes |
Reply: (edit)This may not be the easiest way to do it, but this Change code should do what you asked. Right click the sheet tab, choose View Code and paste this in. It's set to fire on a change to B46...alter as required or replace the Target.Address line with the line at the bottom to include a range of cells. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$46" Then If Target > 60 Or Target < 1 Then MsgBox "Please Enter A Number Between 1 and 60" Target.Select Exit Sub End If Application.EnableEvents = False LunchMin = Target If Target < 10 Then Target = "00:0" & LunchMin Else: Target = "00:" & LunchMin End If End If Application.EnableEvents = True End Sub Use this for a range of cells: If Not Intersect(Target, Range("B5:B46")) Is Nothing Then
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: Coldpaws
Date: September 21, 2007 at 07:48:05 Pacific
Subject: Data Validation - Minutes |
Reply: (edit)Jennifer is correct Pick the cell you want to put data in On Menu Bar select Data --> Validation Pop up opens - Select the 'settings' tab In the 'Allow' box select 'Decimal' In the data box select 'less than' In the Maximum box - enter 60 You can then go the the 'Error Alert' tab and set up some message the user will get if they enter data more than 60 mins. If you're not totally confused , you don't fully understand the question.
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: DerbyDad03
Date: September 21, 2007 at 11:07:49 Pacific
Subject: Data Validation - Minutes |
Reply: (edit)Coldpaws, I only add this because I have worked on one of the OP's spreadsheets and know that he does a lot of time differential calculations. I also know that he knows how to use Data Validation on time values, so... I believe he was specifically looking for a means to have *minutes* entered in a cell that is formatted as time. AFAIK if you format a cell as time and use the Data Validation method as suggested, you will not get the value displayed as minutes. I tried the Data Validation suggestion on a cell which was formatted as time. I entered a value of 45 and the cell displayed 0:00. The formula bar showed 2/14/1900 12:00:00 AM. Using the MINUTE() function on that cell returned 0. As I said, I don't know if my code is the easiest way to do what he wants but at least the cell will display 0:45 and the MINUTE() function will return 45. OTOH, I may not even have made the correct assumption about the OP's actual needs. :-(
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: