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

Thanks jacob, yes it is working through data validation but i want to control
it through vb programming as you mentioned below option2. but option vb
program is not working. i want to set the value with in a limit in a specific
cell eg. (a1 or b1) through vb same through minimum value to maximum value.
waiting your reply.

"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 .