Home |
Search |
Today's Posts |
#1
|
|||
|
|||
cell validation
Hello I just want to restrict user not enter a cell blank. If so he should get an error message saying 'error'. He even should not bypass the cell. How to do it Srini -- srinivas sarma ------------------------------------------------------------------------ srinivas sarma's Profile: http://www.excelforum.com/member.php...o&userid=24834 View this thread: http://www.excelforum.com/showthread...hreadid=383852 |
#2
|
|||
|
|||
Install
========= Right click on the sheet tab and select View Code. Paste the code below in the code window and select select File...Close and return to Microsoft Excel. Use === Select a cell Select Tools...Macro...Macros..MarkNonBlank and press Run To remove from cell, Select the cell and change the colour of the interior to anything other than yellow. Code(Paste this into the code window) ========================= Private OldSelection As Range Private Const NonBlankColor As Single = vbYellow Public Sub MarkNonBlank() Selection.Interior.Color = NonBlankColor End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim BlankCell As Boolean BlankCell = False If OldSelection Is Nothing Then Set OldSelection = Me.Cells(1, 1) End If With OldSelection If .Cells.Count = 1 Then If .Interior.Color = NonBlankColor Then If Trim(.Cells(1)) = "" Then BlankCell = True End If End If End If End With If BlankCell Then OldSelection.Select Else Set OldSelection = Target End If End Sub "srinivas sarma" wrote: Hello I just want to restrict user not enter a cell blank. If so he should get an error message saying 'error'. He even should not bypass the cell. How to do it Srini -- srinivas sarma ------------------------------------------------------------------------ srinivas sarma's Profile: http://www.excelforum.com/member.php...o&userid=24834 View this thread: http://www.excelforum.com/showthread...hreadid=383852 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
List, Data Validation, unlocked cell, protected sheet..... | New Users to Excel | |||
In Cell Validation List & Linked Cell VLOOKUP | Excel Discussion (Misc queries) | |||
Data Validation / Cell Entry | Excel Discussion (Misc queries) | |||
Validation depends on cell value | Excel Worksheet Functions | |||
how to add two data validation lists to a single cell? | Excel Worksheet Functions |