Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I make a cell required to have input? Michele Excel Discussion (Misc queries) 4 April 26th 13 06:00 PM
is it possible to make a cell in excel as entry required max power Excel Discussion (Misc queries) 1 November 8th 06 01:27 PM
can you make a cell value required? nishapurohit Excel Discussion (Misc queries) 2 January 30th 06 11:42 PM
how to make a cell required in excel ncaurora03 Excel Discussion (Misc queries) 1 January 30th 06 06:11 PM
How do I make a value required in a cell in Excel? ex: Name, Last. Pilar Excel Programming 2 October 6th 04 08:03 PM


All times are GMT +1. The time now is 04:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"