ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get the original data in a cell after it is modified (https://www.excelbanter.com/excel-programming/306600-how-get-original-data-cell-after-modified.html)

Raghunandan

How to get the original data in a cell after it is modified
 
Hi All,
I want to write a handler which will be called when the user changes the
contents of a cell and I need to get the value in this cell before
modification.Is there any way to do this?

Thanks in advance

Regards
Raghu


William[_2_]

How to get the original data in a cell after it is modified
 
Hi Raghu

The following sub (insert in the relevant worksheet module) will record any
changes made to cell A1 and place the value prior to changing in column F
and the time it was changed in column G.

Private Sub Worksheet_Change(ByVal Target As Range)
Static vLast As Variant
If Target.Address = "$A$1" Then
If vLast < Target.Value Then
Range("F65000").End(xlUp).Offset(1, 1) = Now
Range("F65000").End(xlUp).Offset(1, 0) = vLast
vLast = Target.Value
End If
End If
End Sub

--
XL2002
Regards

William



"Raghunandan" wrote in message
...
| Hi All,
| I want to write a handler which will be called when the user changes the
| contents of a cell and I need to get the value in this cell before
| modification.Is there any way to do this?
|
| Thanks in advance
|
| Regards
| Raghu
|



Raghunandan

How to get the original data in a cell after it is modified
 
Hi,
I think I was not clear enough.My requirement is like this.I have a
worksheet in which i need to implement 1 to many relationship between data.So
I maintain 2 sheets.The data relationship is somewhat like this

1st sheet:

name description unique_id index
qwert qwerty 1 200
2nd sheet:

index data
200 asdf
200 zxc

if the user changes the index in 1st sheet,I need to go and change the
indexes in 2nd sheet

I don't know how to do this

Regards
Raghu

"William" wrote:

Hi Raghu

The following sub (insert in the relevant worksheet module) will record any
changes made to cell A1 and place the value prior to changing in column F
and the time it was changed in column G.

Private Sub Worksheet_Change(ByVal Target As Range)
Static vLast As Variant
If Target.Address = "$A$1" Then
If vLast < Target.Value Then
Range("F65000").End(xlUp).Offset(1, 1) = Now
Range("F65000").End(xlUp).Offset(1, 0) = vLast
vLast = Target.Value
End If
End If
End Sub

--
XL2002
Regards

William



"Raghunandan" wrote in message
...
| Hi All,
| I want to write a handler which will be called when the user changes the
| contents of a cell and I need to get the value in this cell before
| modification.Is there any way to do this?
|
| Thanks in advance
|
| Regards
| Raghu
|




William[_2_]

How to get the original data in a cell after it is modified
 
Hi Raghu

Is there any reason why you cannot use formulae in column A of the second
sheet to relate to the relevant index in Column D of the first sheet?

--
XL2002
Regards

William



"Raghunandan" wrote in message
...
| Hi,
| I think I was not clear enough.My requirement is like this.I have a
| worksheet in which i need to implement 1 to many relationship between
data.So
| I maintain 2 sheets.The data relationship is somewhat like this
|
| 1st sheet:
|
| name description unique_id index
| qwert qwerty 1 200
| 2nd sheet:
|
| index data
| 200 asdf
| 200 zxc
|
| if the user changes the index in 1st sheet,I need to go and change the
| indexes in 2nd sheet
|
| I don't know how to do this
|
| Regards
| Raghu
|
| "William" wrote:
|
| Hi Raghu
|
| The following sub (insert in the relevant worksheet module) will record
any
| changes made to cell A1 and place the value prior to changing in column
F
| and the time it was changed in column G.
|
| Private Sub Worksheet_Change(ByVal Target As Range)
| Static vLast As Variant
| If Target.Address = "$A$1" Then
| If vLast < Target.Value Then
| Range("F65000").End(xlUp).Offset(1, 1) = Now
| Range("F65000").End(xlUp).Offset(1, 0) = vLast
| vLast = Target.Value
| End If
| End If
| End Sub
|
| --
| XL2002
| Regards
|
| William
|
|

|
| "Raghunandan" wrote in message
| ...
| | Hi All,
| | I want to write a handler which will be called when the user changes
the
| | contents of a cell and I need to get the value in this cell before
| | modification.Is there any way to do this?
| |
| | Thanks in advance
| |
| | Regards
| | Raghu
| |
|
|
|



Raghunandan

How to get the original data in a cell after it is modified
 
I cant do like that because there are chances that user can delete a row and
add the same in the last

"William" wrote:

Hi Raghu

Is there any reason why you cannot use formulae in column A of the second
sheet to relate to the relevant index in Column D of the first sheet?

--
XL2002
Regards

William



"Raghunandan" wrote in message
...
| Hi,
| I think I was not clear enough.My requirement is like this.I have a
| worksheet in which i need to implement 1 to many relationship between
data.So
| I maintain 2 sheets.The data relationship is somewhat like this
|
| 1st sheet:
|
| name description unique_id index
| qwert qwerty 1 200
| 2nd sheet:
|
| index data
| 200 asdf
| 200 zxc
|
| if the user changes the index in 1st sheet,I need to go and change the
| indexes in 2nd sheet
|
| I don't know how to do this
|
| Regards
| Raghu
|
| "William" wrote:
|
| Hi Raghu
|
| The following sub (insert in the relevant worksheet module) will record
any
| changes made to cell A1 and place the value prior to changing in column
F
| and the time it was changed in column G.
|
| Private Sub Worksheet_Change(ByVal Target As Range)
| Static vLast As Variant
| If Target.Address = "$A$1" Then
| If vLast < Target.Value Then
| Range("F65000").End(xlUp).Offset(1, 1) = Now
| Range("F65000").End(xlUp).Offset(1, 0) = vLast
| vLast = Target.Value
| End If
| End If
| End Sub
|
| --
| XL2002
| Regards
|
| William
|
|

|
| "Raghunandan" wrote in message
| ...
| | Hi All,
| | I want to write a handler which will be called when the user changes
the
| | contents of a cell and I need to get the value in this cell before
| | modification.Is there any way to do this?
| |
| | Thanks in advance
| |
| | Regards
| | Raghu
| |
|
|
|





All times are GMT +1. The time now is 02:04 PM.

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