Ok here is my problem, I am unable to use the Excel track changes in my application as it restricts other Excel functionality. so I have written my own VBA code to handle this, it works simply by using:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
so that when the user selects a cell or range it stores all of the data in that range in an array
and in
Private Sub Worksheet_Change(ByVal Target As Range)
it goes through the array and finds the old values and marks it as being changed with a old and new value.
Now the above works fine when the user selects all the cells that they want to change, if however they only click one cell and paste then it wont know about all the other cells (because they are not in the temporary array because they didn’t select them)
My initial idea for this involves looking at the clipboard (which I can do) and predicting how many rows/cols there are in that text when the user selects a cell and store the relevnt number of extra rows & cols. but I don’t know how to turn the text in the clipboard:
(Note: the col headdings dont line up in text - but I copied this off and excel spreadsheet and used code to pull the details back and copied and pasted the result)
Col 1 Col 2 Col 3
Row 1 1 10 20
Row 2 2 11 21
Row 3 3 12 22
Row 4 4 13 23
Row 5 5 14 24
into 6 rows (5 + the col heading) and 4 cols (3 + row heading) so that when the user selects just one cell the code will store 6 rows down and 4 cols across in the array.
Any ideas on how to do this or an alternative solution?
can post code if necessary or clarify the problem =)
Many thanks
Sylvan
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
so that when the user selects a cell or range it stores all of the data in that range in an array
and in
Private Sub Worksheet_Change(ByVal Target As Range)
it goes through the array and finds the old values and marks it as being changed with a old and new value.
Now the above works fine when the user selects all the cells that they want to change, if however they only click one cell and paste then it wont know about all the other cells (because they are not in the temporary array because they didn’t select them)
My initial idea for this involves looking at the clipboard (which I can do) and predicting how many rows/cols there are in that text when the user selects a cell and store the relevnt number of extra rows & cols. but I don’t know how to turn the text in the clipboard:
(Note: the col headdings dont line up in text - but I copied this off and excel spreadsheet and used code to pull the details back and copied and pasted the result)
Col 1 Col 2 Col 3
Row 1 1 10 20
Row 2 2 11 21
Row 3 3 12 22
Row 4 4 13 23
Row 5 5 14 24
into 6 rows (5 + the col heading) and 4 cols (3 + row heading) so that when the user selects just one cell the code will store 6 rows down and 4 cols across in the array.
Any ideas on how to do this or an alternative solution?
can post code if necessary or clarify the problem =)
Many thanks
Sylvan