Advertisement

06.27.2008 at 07:50AM PDT, ID: 23521812
[x]
Attachment Details

How to avoid looping using Target within Worksheet_Change

Asked by brunces in Microsoft Excel Spreadsheet Software, Microsoft Office Suite, Visual Basic Programming

Tags: , , ,

Friends,

Please, does anybody know how to avoid looping using Target within Worksheet_Change?

Example:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A1")) Is Nothing Then
        Exit Sub
    Else:
        Target = Target + 1
    End If
End Sub

When I type 1 in A1, for example, I want Excel to make it 2, but it keeps on looping because every time the value changes, it runs the code again and again. So, that's my point: how to make it runs only once?

Thank you very much for your attention. :)

bruncesStart Free Trial
[+][-]06.27.2008 at 07:52AM PDT, ID: 21884382

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Excel Spreadsheet Software, Microsoft Office Suite, Visual Basic Programming
Tags: Microsoft, Office, 2003, Excel
Sign Up Now!
Solution Provided By: matthewspatrick
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.27.2008 at 07:59AM PDT, ID: 21884457

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 08:03AM PDT, ID: 21884499

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 08:03AM PDT, ID: 21884503

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 08:07AM PDT, ID: 21884549

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 08:09AM PDT, ID: 21884567

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628