Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make a cell required
I want to make a cell that has a drop down list required. eg.: if cel a5 < 0, the drop down option in cell b5 must be chosen, the cell canno be blank. Any suggestions -- cpointc ----------------------------------------------------------------------- cpointcc's Profile: http://www.excelforum.com/member.php...fo&userid=2547 View this thread: http://www.excelforum.com/showthread.php?threadid=38916 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Make a cell required
You can use event macros in Excel to ensure a cell has an entry... This macro will check to see if an entry exists in cell B5 if cell A is less than zero EVERY TIME a change is made to the worksheet. I both conditions are true, it alerts the user and then selects cell B for the user to make an entry. Copy it to the code page of th worksheet that needs the required entry in cell B5: Code ------------------- Private Sub Worksheet_Change(ByVal Target As Range) ' Check for value less than 0 in cell A5 & blank cell B5 ' If both are true, alert user and select B5... If Cells(5, 1) < 0 And Cells(5, 2) = "" Then MsgBox "You must select a value for cell B5." Cells(5, 2).Activate End If End Su ------------------- Additionally, this macro will check to see if an entry exists in cel B5 if cell A5 is less than zero whenever the user tries to CLOSE TH WORKBOOK. If both conditions are true, it prevents the workbook fro closing, alerts the user and then selects cell B5 for the user to mak an entry. Copy it to the code page of the This Workbook object in th file: Code ------------------- Private Sub Workbook_BeforeClose(Cancel As Boolean) ' Check for value less than 0 in cell A5 & blank cell B5 ' If both are true, alert user and select B5... If Cells(5, 1).Value < 0 And Cells(5, 2).Value = "" Then Cancel = True MsgBox "You must select a value for cell B5." Cells(5, 2).Activate End If End Su ------------------- Hope this helps, theDud -- theDud ----------------------------------------------------------------------- theDude's Profile: http://www.excelforum.com/member.php...fo&userid=1655 View this thread: http://www.excelforum.com/showthread.php?threadid=38916 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I make a cell required to have input? | Excel Discussion (Misc queries) | |||
is it possible to make a cell in excel as entry required | Excel Discussion (Misc queries) | |||
can you make a cell value required? | Excel Discussion (Misc queries) | |||
how to make a cell required in excel | Excel Discussion (Misc queries) | |||
How do I make a value required in a cell in Excel? ex: Name, Last. | Excel Programming |