ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changed cell row number... (https://www.excelbanter.com/excel-programming/319677-changed-cell-row-number.html)

Sridhar Pentlavalli via OfficeKB.com

Changed cell row number...
 

Hi

I have a requirement in which I am getting some problem. Lets say I have four columns in a sheet. If first three columns are entered with some values, I need to compute some thing and put it in fourth column. For that purpose I am using "Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)" function. Here the problem I am facing is, in this function, how to get the row number in which the data has been changed?

If I am not clear, let me explain clearly. If data in cells(3,1), cells(3,2) and cells(3,3) is changed, then I need to compute some thing and put it in cells(3,4). Here how to trap the row number as 3 in side the "Workbook_SheetChange" function.

Thanks in advance

--
Message posted via http://www.officekb.com

Tim Williams

Changed cell row number...
 

The Target parameter is a range object, so you can look at
Target.Row
to get the row.

Couple of things to watch for:
1. Target can (I think) be a multi-cell range so you will need to
iterate through the range to make sure you catch all changed rows
2. If you make a change in the SheetChange code then this will in turn
trigger your code again and so on.... You can temporarily disable
events using
Application.eneableevents=false
to prevent this.

Tim.


"Sridhar Pentlavalli via OfficeKB.com" wrote in
message ...

Hi

I have a requirement in which I am getting some problem. Lets say I
have four columns in a sheet. If first three columns are entered
with some values, I need to compute some thing and put it in fourth
column. For that purpose I am using "Private Sub
Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)"
function. Here the problem I am facing is, in this function, how to
get the row number in which the data has been changed?

If I am not clear, let me explain clearly. If data in cells(3,1),
cells(3,2) and cells(3,3) is changed, then I need to compute some
thing and put it in cells(3,4). Here how to trap the row number as 3
in side the "Workbook_SheetChange" function.

Thanks in advance

--
Message posted via http://www.officekb.com





All times are GMT +1. The time now is 02:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com