Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Michael,
Try the following. There was no test for additional values equal to input value. Also inputval was dimensioned then inputvalue used in the code. If you include Option Explicit at the very top of the VBA editor page and then before running the code, Select Debug - Compile. The variables not properly dimensioned will be highlighted before running the code. The On Error should be used with Application.EnableEvents = False. If you get an error in the code and it does not complete running to Application.EnableEvents = True then events remain turned off until you either turn them on with code or restart Excel. Private Sub Worksheet_Change(ByVal Target As Range) Dim isec As Range Dim inputvalue As Variant inputvalue = Target.Value Set isec = Application.Intersect _ (Range("eventRngStable"), Target) On Error GoTo ReEnableEvents Application.EnableEvents = False If isec Is Nothing Then MsgBox "out of range" Else If WorksheetFunction.CountIf _ (Range("eventRngStable"), _ inputvalue) 1 Then Range("eventRngStable").ClearContents Target.Value = inputvalue End If End If ReEnableEvents: Application.EnableEvents = True End Sub -- Regards, OssieMac |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Range Question / error 1004: method Range of object Worksheet has failed | Excel Programming | |||
Range.Find returns cell outside of range when range set to single cell | Excel Programming | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |