LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 40
Default I WANT TO CREATE MANDATORY CELLS

Hi!

You can also try with this code:

Option Explicit
Const cstrMandatory As String = "A:A" 'For column "A" only.
Dim fIsBlank As Boolean
Dim strAddress As String

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If Not Application.Intersect(.Cells(1), _
Range(cstrMandatory)) Is Nothing Then
fIsBlank = .Value = ""
End If
End With
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
If fIsBlank Then
Application.EnableEvents = False
Range(strAddress).Select
MsgBox "This cell required!", vbExclamation
Application.EnableEvents = True
Else
If Not Application.Intersect(.Cells(1), _
Range(cstrMandatory)) Is Nothing Then
If .Count = 1 Then
strAddress = Target.Address
fIsBlank = .Value = ""
End If
End If
End If
End With
End Sub

Creates a "CellTrap" and you can not get out until type something.
Paste this code in code module of your sheet.

Cheers,
John John


Ο χρήστης "LOCK CELLS" *γγραψε:

I WANT TO CREATE MANDATORY CELLS IN WORKSHEET.
IF THE CELLS ARE BLANK THEN NOT ALLOW TO FORWARD.

 
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
Mandatory entry for a group of cells? JB Excel Discussion (Misc queries) 3 May 16th 07 07:51 PM
Mandatory Cells doorguy Excel Worksheet Functions 1 January 8th 07 07:30 PM
Mandatory Cells Mel1221 Excel Worksheet Functions 5 July 5th 06 10:06 PM
Cells to be mandatory fill have a formula in it CBrausa Excel Discussion (Misc queries) 1 June 5th 06 08:17 PM
How to create mandatory cells in a worksheet prakash Excel Worksheet Functions 0 January 15th 05 02:03 PM


All times are GMT +1. The time now is 12:55 PM.

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

About Us

"It's about Microsoft Excel"