Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Tracking newly entered rows.

Currently I have a sheet which contains data in columns A-Q, I have added
some code in WorkSheet_Change to track any changes in the existing data, this
same code is currently telling me that a newly entered row of data has been
changed which is technically correct but I'd rather have it tell me that the
row is a new row rather than changed. Code I'm using is:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim iRow As Integer
If Not Intersect(Target, Range("A:Q")) Is Nothing Then
iRow = Target.Row
Cells(iRow, 19).Value = "Changed!"
End If
End Sub

Currently this puts "Changed!" in column S, if any new code means using yet
another column that would be okay too. It would be cool if it remained in
the same column though.

Ideas or suggestions?

Thanks,

Larry
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Tracking newly entered rows.

Larry,

One thing to try is to create a module-level variable -- or a
Public one if you want to use it elsewhere in your code -- and compare
the current value of it to the Target.row. If Target.row is higher,
it's a new row. Use the worksheet.activate event to initialize the
value (or workbook.open, particularly if you're using a public
variable) by setting it to the last used row on the sheet. Finding the
last used row is a whole separate topic because of how Excel
"remembers" things, but simplistically something like this should get
you started:
dLastCurrentRow = ActiveCell.SpecialCells(xlLastCell).Row

HTH
/ Tyla /



On Apr 17, 12:42 pm, Larry Cooke
wrote:
Currently I have a sheet which contains data in columns A-Q, I have added
some code in WorkSheet_Change to track any changes in the existing data, this
same code is currently telling me that a newly entered row of data has been
changed which is technically correct but I'd rather have it tell me that the
row is a new row rather than changed. Code I'm using is:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim iRow As Integer
If Not Intersect(Target, Range("A:Q")) Is Nothing Then
iRow = Target.Row
Cells(iRow, 19).Value = "Changed!"
End If
End Sub

Currently this puts "Changed!" in column S, if any new code means using yet
another column that would be okay too. It would be cool if it remained in
the same column though.

Ideas or suggestions?

Thanks,

Larry



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Tracking newly entered rows.

Thanks Tyla, though I just thought of another twist in things. Sometimes
they will copy an entire row and insert it into the sheet and then modify the
different cells rather than inserting a blank row. This is getting more
complicated than I originally thought so I'm going to have to rethink the
whole concept now. I will keep your idea in mind, it's a good one just not
sure it's going to handle my situation now.

Thank you,

Larry

"Tyla" wrote:

Larry,

One thing to try is to create a module-level variable -- or a
Public one if you want to use it elsewhere in your code -- and compare
the current value of it to the Target.row. If Target.row is higher,
it's a new row. Use the worksheet.activate event to initialize the
value (or workbook.open, particularly if you're using a public
variable) by setting it to the last used row on the sheet. Finding the
last used row is a whole separate topic because of how Excel
"remembers" things, but simplistically something like this should get
you started:
dLastCurrentRow = ActiveCell.SpecialCells(xlLastCell).Row

HTH
/ Tyla /



On Apr 17, 12:42 pm, Larry Cooke
wrote:
Currently I have a sheet which contains data in columns A-Q, I have added
some code in WorkSheet_Change to track any changes in the existing data, this
same code is currently telling me that a newly entered row of data has been
changed which is technically correct but I'd rather have it tell me that the
row is a new row rather than changed. Code I'm using is:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim iRow As Integer
If Not Intersect(Target, Range("A:Q")) Is Nothing Then
iRow = Target.Row
Cells(iRow, 19).Value = "Changed!"
End If
End Sub

Currently this puts "Changed!" in column S, if any new code means using yet
another column that would be okay too. It would be cool if it remained in
the same column though.

Ideas or suggestions?

Thanks,

Larry




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Tracking newly entered rows.

Larry,

Life would be so much easier without creative users -- but a lot
less fun.

/ Tyla /

On Apr 17, 2:04 pm, Larry Cooke
wrote:
ThanksTyla, though I just thought of another twist in things. Sometimes
they will copy an entire row and insert it into the sheet and then modify the
different cells rather than inserting a blank row. This is getting more
complicated than I originally thought so I'm going to have to rethink the
whole concept now. I will keep your idea in mind, it's a good one just not
sure it's going to handle my situation now.

Thank you,

Larry

"Tyla" wrote:
Larry,


One thing to try is to create a module-level variable -- or a
Public one if you want to use it elsewhere in your code -- and compare
the current value of it to the Target.row. If Target.row is higher,
it's a new row. Use the worksheet.activate event to initialize the
value (or workbook.open, particularly if you're using a public
variable) by setting it to the last used row on the sheet. Finding the
last used row is a whole separate topic because of howExcel
"remembers" things, but simplistically something like this should get
you started:
dLastCurrentRow = ActiveCell.SpecialCells(xlLastCell).Row


HTH
/Tyla/


On Apr 17, 12:42 pm, Larry Cooke
wrote:
Currently I have a sheet which contains data in columns A-Q, I have added
some code in WorkSheet_Change to track any changes in the existing data, this
same code is currently telling me that a newly entered row of data has been
changed which is technically correct but I'd rather have it tell me that the
row is a new row rather than changed. Code I'm using is:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim iRow As Integer
If Not Intersect(Target, Range("A:Q")) Is Nothing Then
iRow = Target.Row
Cells(iRow, 19).Value = "Changed!"
End If
End Sub


Currently this puts "Changed!" in column S, if any new code means using yet
another column that would be okay too. It would be cool if it remained in
the same column though.


Ideas or suggestions?


Thanks,


Larry



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rows to drop off (hide) when a value is entered into a cell jbeck068 Excel Discussion (Misc queries) 4 June 22nd 06 01:47 AM
Can I rearrange data entered in rows into colums in Excel? Robin Excel Discussion (Misc queries) 1 January 30th 06 07:48 PM
Excel will not show all text entered in a Cell merged from 9 rows Pat Excel Discussion (Misc queries) 6 August 18th 05 11:14 PM
Why won't my newly entered data sort with old data ? laura Excel Discussion (Misc queries) 2 August 3rd 05 04:26 PM
Why won't my newly entered data sort with old data ? laura Excel Discussion (Misc queries) 0 August 3rd 05 03:37 PM


All times are GMT +1. The time now is 07:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"