+ Reply to Thread
Results 1 to 5 of 5

Need to determine the ROW of the TARGET in a Worksheet Change Even

  1. #1
    Barb Reinhardt
    Guest

    Need to determine the ROW of the TARGET in a Worksheet Change Even

    How do I determine what row number the TARGET is located in for a
    WORKSHEET_Change event. My target MUST be one cell or this piece of the
    code won't work.

    Can someone assist?

    Thanks,
    Barb Reinhardt

  2. #2
    Don Guillett
    Guest

    Re: Need to determine the ROW of the TARGET in a Worksheet Change Even

    how about
    if target.address="$A$1" then

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Barb Reinhardt" <[email protected]> wrote in message
    news:[email protected]...
    > How do I determine what row number the TARGET is located in for a
    > WORKSHEET_Change event. My target MUST be one cell or this piece of the
    > code won't work.
    >
    > Can someone assist?
    >
    > Thanks,
    > Barb Reinhardt




  3. #3
    Barb Reinhardt
    Guest

    Re: Need to determine the ROW of the TARGET in a Worksheet Change

    I'm not sure I made myself clear. I could change a cell anywhere between
    D13 and D100 (for example) and I want to know what row # the cell was in.
    If I change D20, I want 20 returned. How do I do that?

    "Don Guillett" wrote:

    > how about
    > if target.address="$A$1" then
    >
    > --
    > Don Guillett
    > SalesAid Software
    > [email protected]
    > "Barb Reinhardt" <[email protected]> wrote in message
    > news:[email protected]...
    > > How do I determine what row number the TARGET is located in for a
    > > WORKSHEET_Change event. My target MUST be one cell or this piece of the
    > > code won't work.
    > >
    > > Can someone assist?
    > >
    > > Thanks,
    > > Barb Reinhardt

    >
    >
    >


  4. #4
    Bernie Deitrick
    Guest

    Re: Need to determine the ROW of the TARGET in a Worksheet Change

    Target is the changed range object:

    If Target.Cells.Count > 1 Then
    Msgbox "More than one cell!"
    Exit Sub
    End If
    myRow = Target.Row
    MsgBox "The changed cell was cell " & Target.Address & ", which is row " & myRow


    --
    HTH,
    Bernie
    MS Excel MVP


    "Barb Reinhardt" <[email protected]> wrote in message
    news:[email protected]...
    > I'm not sure I made myself clear. I could change a cell anywhere between
    > D13 and D100 (for example) and I want to know what row # the cell was in.
    > If I change D20, I want 20 returned. How do I do that?
    >
    > "Don Guillett" wrote:
    >
    >> how about
    >> if target.address="$A$1" then
    >>
    >> --
    >> Don Guillett
    >> SalesAid Software
    >> [email protected]
    >> "Barb Reinhardt" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > How do I determine what row number the TARGET is located in for a
    >> > WORKSHEET_Change event. My target MUST be one cell or this piece of the
    >> > code won't work.
    >> >
    >> > Can someone assist?
    >> >
    >> > Thanks,
    >> > Barb Reinhardt

    >>
    >>
    >>




  5. #5
    Bernie Deitrick
    Guest

    Re: Need to determine the ROW of the TARGET in a Worksheet Change

    Oh, and if you want to limit when the event is actually used,

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("D13:D100")) Is Nothing Then Exit Sub
    If Target.Cells.Count > 1 Then
    MsgBox "More than one cell!"
    Exit Sub
    End If
    myRow = Target.Row
    MsgBox "The changed cell was cell " & Target.Address & ", which is row " & myRow

    End Sub

    HTH,
    Bernie
    MS Excel MVP


    "Bernie Deitrick" <deitbe @ consumer dot org> wrote in message
    news:[email protected]...
    > Target is the changed range object:
    >
    > If Target.Cells.Count > 1 Then
    > Msgbox "More than one cell!"
    > Exit Sub
    > End If
    > myRow = Target.Row
    > MsgBox "The changed cell was cell " & Target.Address & ", which is row " & myRow
    >
    >
    > --
    > HTH,
    > Bernie
    > MS Excel MVP
    >
    >
    > "Barb Reinhardt" <[email protected]> wrote in message
    > news:[email protected]...
    >> I'm not sure I made myself clear. I could change a cell anywhere between
    >> D13 and D100 (for example) and I want to know what row # the cell was in.
    >> If I change D20, I want 20 returned. How do I do that?
    >>
    >> "Don Guillett" wrote:
    >>
    >>> how about
    >>> if target.address="$A$1" then
    >>>
    >>> --
    >>> Don Guillett
    >>> SalesAid Software
    >>> [email protected]
    >>> "Barb Reinhardt" <[email protected]> wrote in message
    >>> news:[email protected]...
    >>> > How do I determine what row number the TARGET is located in for a
    >>> > WORKSHEET_Change event. My target MUST be one cell or this piece of the
    >>> > code won't work.
    >>> >
    >>> > Can someone assist?
    >>> >
    >>> > Thanks,
    >>> > Barb Reinhardt
    >>>
    >>>
    >>>

    >
    >




+ 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