Thread: Enable events
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Enable events

Hi John,

you have to process the worksheet_change event. Maybe the following
code is of sme help for you:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim var_input
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("B:B")) Is Nothing Then Exit Sub
If Target.Value = 1 And Me.Cells(Target.Row, "A").Value = 1 Then
On Error GoTo CleanUp:
Application.EnableEvents = False
var_input = InputBox("Enter your cost value")
Me.Cells(Target.Row, "Z").Value = var_input
End If

CleanUp:
Application.EnableEvents = True
End Sub

Frank
John C wrote:
Hi...

I'm struggling to refine some code to automate the following.

if A1=1 and B1=1 then I want an input box triggered to request a cost
value that will go into Z1. The input box must be triggered by
placing the 1 into B1 rather than A1. I have a desscending list going
down 800 rows by which the input box value must be offset. eg the
same must apply to a800, b800 and z800 as it does for all rows above.

Anyhelp would be super.

John C