Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I cannot get my code to work! i am trying to just check
that when the user enters a value in cell Y13 that its a 9 digit numeric value but every time i enter a value. it always goes to the last condition "Must be 9 digits" even when i enter in a correct value what's wrong here?! help! :) Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("Y13")) Is Nothing Then With Target 'do something If Len(Y13) = 9 Then If IsNumeric(Y13) Then Y13.NumberFormat = "###-###-###" Else MsgBox "Must be a number" End If Else MsgBox "Must be 9 digits" End If End With End If ws_exit: Application.EnableEvents = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
option buttons run Click code when value is changed via VBA code | Excel Programming | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming |