+ Reply to Thread
Results 1 to 2 of 2

Worksheet_change event multiple

  1. #1
    jeffP
    Guest

    Worksheet_change event multiple

    I wanted to test data input on more than one cell. Trying to enter more than
    one worksheet_change returns the "ambiguous name" error (same sub name). I
    realize that I can do all my IF tests and code calls under the one
    Worksheet_change event but it gets crowded.
    Is it the only way ?

    Thanks for any help and education.
    jeffp

  2. #2
    John.Greenan
    Guest

    RE: Worksheet_change event multiple

    You can only habe one worksheet_change event per worksheet. This is the only
    way to do it. what you could do is split up the if..elseif..else...end if
    from the actual implementation code - something like

    Private Sub Worksheet_Change(ByVal Target As Range)

    if target.column = 1 then
    call DoStuffToColumn1(target)
    elseif target.column = 2 then
    call DoStuffToColumn2(target)
    else
    ...do whatever
    end if

    End Sub

    private function DoStuffToColumn1(Target as excel.range)
    ....write code here
    end function

    private function DoStuffToColumn2(Target as excel.range)
    ....write code here
    end function


    --
    www.alignment-systems.com


    "jeffP" wrote:

    > I wanted to test data input on more than one cell. Trying to enter more than
    > one worksheet_change returns the "ambiguous name" error (same sub name). I
    > realize that I can do all my IF tests and code calls under the one
    > Worksheet_change event but it gets crowded.
    > Is it the only way ?
    >
    > Thanks for any help and education.
    > jeffp


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1