View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Imran Imran is offline
external usenet poster
 
Posts: 15
Default Programming problem

Dear Jacob,

for A1 value range is 5-100
for B1 value range is 101-200
for C1 value range is 201-300

really i am very thank full to you for your kind support

"Jacob Skaria" wrote:

Imran, change the range in App,Intersect as below...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim intCol As Integer
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:C1")) Is Nothing Then
If Target.Value < 5 Or Target.Value 100 Then
MsgBox " Invalid Entry": Target.Value = ""
End If
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Imran" wrote:

Dear Jacob thanks dear vb programm is also working now but if i want to same
for another cell then how i can fix same with "a1" cell and "b1" & c1". can
you help me to fixed the 3 or 4 cell with in a program.

thanks in advance
imran

"Jacob Skaria" wrote:

Hi Imran

1. Use Data validtionAllow Whole number Select the minimum and maximum and
from error alert tab "You can place a customized message"

2. If you want to have this programatically use the worksheet change event.
Chanage the range to suit your requirement.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim intCol As Integer
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
If Target.Value < 5 Or Target.Value 100 Then
MsgBox " Invalid Entry": Target.Value = ""
End If
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Imran" wrote:

I want to fixed the cell to enter the data in specific range 5 to 100 or
100. basically i want to lock the worksheet cell and enter data in the cell
within the specefic range that i will provide .