#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Validation

How can i do the validation that if I want the data to be insert i
integer? If other then integer, an error msg will pop up.

My code is as follow:


If TextHours.Value = "" Then
MsgBox "You must enter a value in working hour."
Exit Sub


I had tried before the code following... but cannot work

If TextHours.Value = "" Or TextHours.Value < int Then
MsgBox "You must enter a value in working hour."
Exit Sub


Can u all point out what is the mistake that I had done

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Validation

and 1 more question.... what is the VBA code that do the validation tha
cannot have duplicate entries ?

For example, cannot have 2 different id for the entries

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Validation

Hi,

Try,

Sub nonnum()
Application.ScreenUpdating = False
Worksheets("sheet1").Activate
If Not (IsNumeric(Range("b1").Value)) Then
MsgBox "Last Backup was on: " & Range("b1").Value
End If
End Sub


Hope this gets you started

Charle

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Validation

Thanks for the reply, Charles... Anyway... It cannot help solve m
problem. My codes are as follow:

If TextName.Text = "" Then
MsgBox "You must enter a name."
Exit Sub
End If

If TextHours.Value = "" Then
MsgBox "You must enter a value in working hour."
Exit Sub
Else
If TextHours.Value 8 Then
OT = TextHours.Value - 8
MsgBox "Your OT is," & OT
End If
End If




I want to do the validation so that the TextHours.Value can just accep
the integer numbers only. If user key in alphabet or any sign inside
it will pop up an error msg.

Hope u can help me to solve this problem... THank

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Validation

unplug,

Check the attachment. This is what I came up with.
Range A1 is named "texthour"
Range B1 is named "textname"

HTH

Charle

Attachment filename: unplug.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=57184
--
Message posted from http://www.ExcelForum.com

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
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
Validation (Drop down list vs simple text length validation) Bob Phillips[_6_] Excel Programming 2 April 27th 04 07:47 PM
Validation (Drop down list vs simple text length validation) Jason Morin[_2_] Excel Programming 1 April 27th 04 04:56 PM
Validation (Drop down list vs simple text length validation) Pete McCosh Excel Programming 0 April 27th 04 03:49 PM


All times are GMT +1. The time now is 04:29 PM.

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"