Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_Change Event Strange Behaviour
Hi,
I have been cracking my head to solve this problem for few days to no avail. hopefully someone can help me. I have 1 cell with drop down list, when the user enter a value that is not in the list, they'll get an error (set from Data Validation). If they enter a correct value, the message will be displayed from Worksheet_Change event below. It's all fine if they always enter the correct value but when they enter the wrong value and correct it afterwards (Excel will ask if they want to try again), the Worksheet_Change event will run twice. When the user enter the wrong value twice, the event will run 4 times (it doubles the number). Private Sub Worksheet_Change(ByVal Target As Range) Dim c Dim x Dim rng As Range Dim vRow As Double Dim sPrn As String Dim currCell As Range 'Dim OldVal Dim lngFound On Error GoTo errWorksheet_Change With Target If .Count = 1 Then 'Change printer If Not Intersect(.Cells, Range("C5")) Is Nothing Then Application.EnableEvents = False If .Cells < "" Then Application.ActivePrinter = Worksheets("Main").Cells(rowPrinter, 3).Value & " on LPT1:" MsgBox Application.ActivePrinter & " is activated!" Else MsgBox "No barcode printer is available!" End If Application.EnableEvents = True End If continue...... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Strange if(***) behaviour? | Excel Discussion (Misc queries) | |||
Strange VBA Behaviour | Excel Programming | |||
Strange behaviour | Excel Worksheet Functions | |||
Strange behaviour in VBA Help | Excel Programming | |||
strange behaviour | Excel Programming |