Dimitris31
New Member
- Joined
- Oct 9, 2013
- Messages
- 1
Hi to all,
I want to say from the start that I am new and I don't have any exprerience to VBA language!.
However I know clearly what I want to do.
THE GOAL: I am using EXCEL 2003 and I want to record the values from a group of cells when they change, at a different sheet, let's say LOG_ELEV.
I have searched to the forum for similar questions and I have decided to use the following code which is working perfectly only for one cell.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "G11" Then
With Sheets("LOG_ELEV").Range("A" & Rows.Count).End(xlUp).Offset(1)
.Value = Target
End With
End If
When I change the value of G11 then this value is recorded to the column A of the "LOG_ELEV" sheet at a descending chronologically order.
If I want to add a second cell I would add new code (rewriting the old one) like this:
If Target.Address(False, False) = "G12" Then
With Sheets("LOG_ELEV").Range("B" & Rows.Count).End(xlUp).Offset(1)
.Value = Target
End With
End If
And if I wanted to apply this for 500 cells I would rewrite the code for 500 times?
The logic is that the group of cells that I want to keep in track their values change, are all from the column G and goes like this:
G01 records its value to the column A of "LOG_ELEV" sheet.
G02 goes to column B.... and so on...
After a certain cells I may want to change the log sheet and start over:
G22 goes to column A
G23 goes to column B ...and son on...
Is there any way of re-programming it and easily apply it for the certain group of cells?
Thank you for your time and patience!
I want to say from the start that I am new and I don't have any exprerience to VBA language!.
However I know clearly what I want to do.
THE GOAL: I am using EXCEL 2003 and I want to record the values from a group of cells when they change, at a different sheet, let's say LOG_ELEV.
I have searched to the forum for similar questions and I have decided to use the following code which is working perfectly only for one cell.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "G11" Then
With Sheets("LOG_ELEV").Range("A" & Rows.Count).End(xlUp).Offset(1)
.Value = Target
End With
End If
When I change the value of G11 then this value is recorded to the column A of the "LOG_ELEV" sheet at a descending chronologically order.
If I want to add a second cell I would add new code (rewriting the old one) like this:
If Target.Address(False, False) = "G12" Then
With Sheets("LOG_ELEV").Range("B" & Rows.Count).End(xlUp).Offset(1)
.Value = Target
End With
End If
And if I wanted to apply this for 500 cells I would rewrite the code for 500 times?
The logic is that the group of cells that I want to keep in track their values change, are all from the column G and goes like this:
G01 records its value to the column A of "LOG_ELEV" sheet.
G02 goes to column B.... and so on...
After a certain cells I may want to change the log sheet and start over:
G22 goes to column A
G23 goes to column B ...and son on...
Is there any way of re-programming it and easily apply it for the certain group of cells?
Thank you for your time and patience!