Automate macro revisited (Frank & Co)

  • Thread starter Thread starter Douglas
  • Start date Start date
D

Douglas

The code below works just fine -- but only if the target
sheet has focus.

I have 2 sheets:

Sheet1 is where the user enters some employee data,
i.e. Full Time/Part Time;

Sheet2 (the target) allows the user to post prior
service history. But the computation is a bit different
for a part time employee.

Once both sheets are are completed all is well. UNLESS
the user returns to sheet1 and changes a Full Timer to a
Part Timer. If that happenes I need to reset sheet2 to
its initial values.

Attempts to watch for the change from sheet1, the call to
my macro (which is in a module) amounts to a no-op.

What now?

Doug



Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then
Exit Sub
On Error GoTo CleanUp:
With Target
If .Value Then
Application.EnableEvents = False
Call ResetPriorService
End If
End With

CleanUp:
Application.EnableEvents = True
End Sub
 
Hi Doug

At first glance this doesn't make much sense to me:

With Target
If .Value Then

Shouldn't it read something like

With Target
If .Value = "Part Timer" Then

?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top