Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Event Procedure not working

I am just working on a simple data validation code, and its not working.
Any help would be appreciated. Thanks in advance

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "A:A" Then
If Len(Target) 5 Then
MsgBox "Must be 5 or less Characters"
Target.ClearContents
End If
End If
End Sub


--
Ariel Dugan
Assistant Manager
Down To Earth Natural Foods


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Event Procedure not working

Hi AD108,

Try changing:

If Target.Address = "A:A" Then

to
If Target.Column = 1 Then

However, why not use Excel's data validation rather than even code?


---
Regards,
Norman



"AD108" wrote in message
...
I am just working on a simple data validation code, and its not working.
Any help would be appreciated. Thanks in advance

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "A:A" Then
If Len(Target) 5 Then
MsgBox "Must be 5 or less Characters"
Target.ClearContents
End If
End If
End Sub


--
Ariel Dugan
Assistant Manager
Down To Earth Natural Foods




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Event Procedure not working

Hi AD108,

even code == event code

---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Event Procedure not working

Thanks Norman,

I appreciate the help.

I am just trying to learn the language, I'm not actually trying to
accomplish anything.



--
Ariel Dugan
Assistant Manager
Down To Earth Natural Foods
808-947-7678 Phone
808-943-8491 Fax
808-282-5916 Cell

"Norman Jones" wrote in message
...
Hi AD108,

Try changing:

If Target.Address = "A:A" Then

to
If Target.Column = 1 Then

However, why not use Excel's data validation rather than even code?


---
Regards,
Norman



"AD108" wrote in message
...
I am just working on a simple data validation code, and its not working.
Any help would be appreciated. Thanks in advance

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "A:A" Then
If Len(Target) 5 Then
MsgBox "Must be 5 or less Characters"
Target.ClearContents
End If
End If
End Sub


--
Ariel Dugan
Assistant Manager
Down To Earth Natural Foods






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Event Procedure not working

Norman,

I used Excel's validation and it works fine until a new row is added and the
validation moves down. My spreadsheet has a routine wich adds a new data row
at row3 for the new entry. The validation moves with the old row 3 to row 4
vwith the old data. The routine also specifies row 3 after the row addition
as follows:

Range("E3").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=transtype"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Invalid Data"
.InputMessage = ""
.ErrorMessage = "You must choose from the drop-down list."
.ShowInput = True
.ShowError = True
End With

It is not working and I am stymied as to what is wrong. Can you help?

Thanks,

Jim
--
Pops Jackson


"Norman Jones" wrote:

Hi AD108,

even code == event code

---
Regards,
Norman



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
workbook_Open event Procedure peerless Excel Discussion (Misc queries) 1 May 22nd 06 10:21 PM
Event Procedure Paul Johnson[_2_] Excel Programming 1 February 2nd 05 01:29 PM
Event Procedure again Paul Johnson[_2_] Excel Programming 1 February 2nd 05 01:28 PM
Event Procedure Programming Jeff Armstrong Excel Programming 1 July 29th 04 03:54 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"