Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Track changes in a row

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
I am running Excel 2003, using a sheet generated by my Visual Foxpro application. There are about 6000 rows, each corresponding to the fields from a record in a VFP table.

Some of the cells may be edited (using Excel) and I then read the file back into my VFP application, where I apply the changes that the user has made (in Excel) to the original table.

I would like to know which rows have been edited, so that I do not have to check every cell in every row.

Is there a way that I can arrange for Excel to set a flag in the first column of a row when a change is made to any cell in that row?

Thanks. Andrew
 
Have a look at the Worksheet_Change event procedure and the Application.EnableEvents method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for your prompt reply, PH. I have limited experience of VBA programming, but keen to learn. Following your guidance I found a reference to the worksheet_change event (on the ozgrid.com site) which led me to see that there is a procedure :

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub


Do you know what code I could put there in order to make a change in a cell cause the setting of a flag in the first column of that row? I take it that if I put some code in this procedure, it will be invoked whenever any cell is updated.

Thanks again.
 
A starting point:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1) = -1
Application.EnableEvents = True
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 



Right-Click the SHEET TAB of the sheet in question and select View Code

In the Code Window, there are TWO DropDown controls at the top.

The LEFT DropDown has General & Worksheet. SELECT Worksheet.

The RIGHT DropDown has the Events for the Worksheet. Select CHANGE.



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top