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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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

(e-mail address removed)

| 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
|
 
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
 
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

(e-mail address removed)

| 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
| >
| > (e-mail address removed)
| >
| > | > | 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
| > |
| >
| >
| >
 
I cant do like that because there are chances that user can delete a row and
add the same in the last
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top