ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Locking info in cells (https://www.excelbanter.com/excel-discussion-misc-queries/146552-locking-info-cells.html)

Yendorian

Locking info in cells
 
In Excel Pro 2003, I am trying to enter data from one cell only (A1 €“ Jones)
and have it saved in another column of cells.(Column C1). If I enter €˜=$A$1
in cell C1, I get the name in that cell €“ which is fine.
My problem is that I now want to enter a new name from cell (A1 €“ this time
Brown) and have it saved in the new cell C2 without changing the Jones name
in C1, but of course the formula €˜=$A$1 puts Brown in the new cell. C2 and
changes
C1 to Brown also.
Ideally I want to enter Jones, Brown, Smith, Evans, Davis etc. into cell A1
and have them fixed iin Column C giving a list of different names in Column
C. Any help gratefully received.


Gord Dibben

Locking info in cells
 
Why not just enter the names in column C and dispense with A1 and linking?

But here is a method using event code.

First in C1 copy/paste as value the formula resulting in Jones.

Then right-click on the sheet tab and "View Code".

Copy/paste this event code into that module.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo stoppit
Application.EnableEvents = False
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
With Target
If .Value < "" Then
ActiveSheet.Cells(Rows.Count, "C").End(xlUp) _
.Offset(1, 0).Value = Target.Value
End If
End With
stoppit:
Application.EnableEvents = True
End Sub

As you enter names in A1 they will be listed down column C


Gord Dibben MS Excel MVP

On Thu, 14 Jun 2007 14:20:01 -0700, Yendorian
wrote:

In Excel Pro 2003, I am trying to enter data from one cell only (A1 – Jones)
and have it saved in another column of cells.(Column C1). If I enter ‘=$A$1’
in cell C1, I get the name in that cell – which is fine.
My problem is that I now want to enter a new name from cell (A1 – this time
Brown) and have it saved in the new cell C2 without changing the Jones name
in C1, but of course the formula ‘=$A$1’ puts Brown in the new cell. C2 and
changes
C1 to Brown also.
Ideally I want to enter Jones, Brown, Smith, Evans, Davis etc. into cell A1
and have them fixed iin Column C giving a list of different names in Column
C. Any help gratefully received.



Gary''s Student

Locking info in cells
 
Use this small event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then
Exit Sub
End If
Application.EnableEvents = False
n = Cells(Rows.Count, "C").End(xlUp).Row + 1
Cells(n, "C").Value = Target.Value
Application.EnableEvents = True
End Sub
--
Gary''s Student - gsnu200729

Don Guillett

Locking info in cells
 
right click sheet tabview codecopy/paste this. Now when you put anything
in cell a1 it will be added to a list starting at the next available row in
col C. Why Jones? You may want to delete the Target="Jones" line.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address < "$A$1" Then Exit Sub
lr = Cells(Rows.Count, "c").End(xlUp).Row + 1
Cells(lr, "c") = Target
Target = "Jones"
Application.EnableEvents = True
End Sub

--
Don Guillett
SalesAid Software

"Yendorian" wrote in message
...
In Excel Pro 2003, I am trying to enter data from one cell only (A1 €“
Jones)
and have it saved in another column of cells.(Column C1). If I enter
€˜=$A$1
in cell C1, I get the name in that cell €“ which is fine.
My problem is that I now want to enter a new name from cell (A1 €“ this
time
Brown) and have it saved in the new cell C2 without changing the Jones
name
in C1, but of course the formula €˜=$A$1 puts Brown in the new cell. C2
and
changes
C1 to Brown also.
Ideally I want to enter Jones, Brown, Smith, Evans, Davis etc. into cell
A1
and have them fixed iin Column C giving a list of different names in
Column
C. Any help gratefully received.




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

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