![]() |
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 |
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 "Barb Reinhardt" wrote in message ... 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 |
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 "Barb Reinhardt" wrote in message ... 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 |
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" wrote in message ... 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 "Barb Reinhardt" wrote in message ... 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 |
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 ... 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" wrote in message ... 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 "Barb Reinhardt" wrote in message ... 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 |
All times are GMT +1. The time now is 03:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com