|
-
Dec 13th, 2004, 03:23 PM
#1
Thread Starter
Fanatic Member
excel query....
hi,
cud i make excel accept date of particluar format only?ecither manually or thru VB code......
thanks and regards
vivek.s
-
Dec 13th, 2004, 03:41 PM
#2
Re: excel query....
you format cells before you enter data into them, and it formats them as you enter the data. i don't think you can do anything other than check the data.
-
Dec 13th, 2004, 04:23 PM
#3
Thread Starter
Fanatic Member
Re: excel query....
yes.......i was able to format the cells to accept date of a particular format but if enter some text(grabage values) still it accepts it......is there anyway to restrict the column to only accept dates?
thanks and regards
vivek.s
-
Dec 13th, 2004, 08:02 PM
#4
Fanatic Member
Re: excel query....
 Originally Posted by vivek.shankar
yes.......i was able to format the cells to accept date of a particular format but if enter some text(grabage values) still it accepts it......is there anyway to restrict the column to only accept dates?
thanks and regards
vivek.s
As dglienna said,
all you can do now is to validate the contents of the cell to see if it's a valid date from the garbage -
-
Dec 13th, 2004, 08:10 PM
#5
Re: excel query....
have the data entered into an unformatted cell. that way it will be easy to see what they were trying to do, rather than have excel change their input into what it thinks they wanted
-
Dec 13th, 2004, 09:40 PM
#6
Re: excel query....
Hey Vivek, you could use the selection and validate the cell contents there.
If its not a date then clear the cell and alert the user.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If IsDate(ActiveCell) = False Then
MsgBox "Not a Date!", vbOKOnly
End If
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 16th, 2004, 04:37 PM
#7
Thread Starter
Fanatic Member
Re: excel query....
hi,
how can i alert if its not of particular format?for example if it is not of mm-dd-yyyy format.......
Thanks and Regards
S.vivek
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|