LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Calculate event to do what Change event does.

The changes in column C are the result of formulas.

The Change Event works fine for changes entered in column C.

Not getting the Calculate to either 'see' the change/calculate or Evaluate the Countif when the formulas produce a duplicate in column C.

Thanks.

Howard


Private Sub Worksheet_Calculate()
Dim Target As Range
Set Target = Columns(3)

If Evaluate("Countif(C1:C100," & Target.Address & ")") 1 Then
MsgBox Target.Value & " is a duplicate entry. It will be removed.", vbExclamation, "Data Entry Editor"
Target.Resize(1, 10).ClearContents
End If

End Sub

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count 1 Then Exit Sub
If Target.Column = 3 And Len(Target.Value) 0 Then

If Evaluate("Countif(C:C," & Target.Address & ")") 1 Then
MsgBox Target.Value & " is a duplicate entry. It will be removed.", vbExclamation, "Data Entry Editor"
Target.Resize(1, 10).ClearContents
End If

End If

End Sub
 
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
Event codes don't fire with change or calculate L. Howard Excel Programming 3 April 21st 15 05:31 PM
apply cell change event to single column - WorksheetChange Event [email protected] Excel Programming 6 May 4th 08 02:28 AM
MsgBox in Enter event causes combobox not to run Change event Richard Excel Programming 0 March 6th 06 02:52 PM
Change event and calculate event Antje Excel Programming 1 March 29th 05 09:03 PM


All times are GMT +1. The time now is 01:28 AM.

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"