#1   Report Post  
srinivas sarma
 
Posts: n/a
Default 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   Report Post  
Hayeso
 
Posts: n/a
Default

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
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
List, Data Validation, unlocked cell, protected sheet..... Kane New Users to Excel 6 July 16th 12 09:11 AM
In Cell Validation List & Linked Cell VLOOKUP BEEZ Excel Discussion (Misc queries) 7 July 1st 07 07:17 PM
Data Validation / Cell Entry Steve Jones Excel Discussion (Misc queries) 4 March 23rd 05 03:23 PM
Validation depends on cell value SteveT Excel Worksheet Functions 2 January 31st 05 06:17 PM
how to add two data validation lists to a single cell? Mike Peter Excel Worksheet Functions 1 December 8th 04 08:22 PM


All times are GMT +1. The time now is 02:13 AM.

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"