Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the
window that appears.
You can remove or comment out the line
MsgBox "I just added """ & Target.Value & """ to the list."
if you don't want to be notified when the project list is changed.
You can remove the formula in cell D2 since all it will do in the future is to return the value
entered in C2.
If your named range "projects" is dynamic, then you can remove the lines from On Error Resume Next
to the end.
If it is not dynamic, then those lines will update that named range to include the newest additions.
HTH,
Bernie
MS Excel MVP
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$C$2" Then Exit Sub
If IsError(Application.Match(Target.Value, Range("A:A"), False)) Then
Application.EnableEvents = False
Range("A2").End(xlDown)(2).Value = Target.Value
MsgBox "I just added """ & Target.Value & """ to the list."
Application.EnableEvents = True
End If
On Error Resume Next
ActiveWorkbook.Names("projects").Delete
ActiveWorkbook.Names.Add Name:="projects", RefersTo:= _
"='" & Target.Parent.Name & "'!" & Range("A3", Cells(Rows.Count, 1).End(xlUp)).Address
End Sub
> Column A contains numerous cells with a project number (for example
> 200746498). The number of cells valued can change, right now we have values
[quoted text clipped - 29 lines]
>> >
>> > - Show quoted text -
robeck - 22 May 2008 19:07 GMT
That works (almost), now when I input a project id in cell C2 (one that is
not already on the list) it adds it in cell A8 which already had a value in
it and continues to add any subsequent ids in cell A8. Thanks so much for
your help so far, it is really appreciated.
> Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the
> window that appears.
[quoted text clipped - 65 lines]
> >> >
> >> > - Show quoted text -
Bernie Deitrick - 22 May 2008 19:35 GMT
Based on your description, I assumed that your list started in cell A2 with a header value, and then
the actual values started in C3. Apparently, your first entry is in Cell A8. You can either
replace the A2 with A8, and A3 with A9, or use
Cells(Rows.Coount,1).End(xlUp)(2).Value = Target.Value
in place of
Range("A2").End(xlDown)(2).Value = Target.Value
HTH,
Bernie
MS Excel MVP
> That works (almost), now when I input a project id in cell C2 (one that is
> not already on the list) it adds it in cell A8 which already had a value in
[quoted text clipped - 72 lines]
>> >> >
>> >> > - Show quoted text -
robeck - 22 May 2008 20:20 GMT
That works great, thank you so much for your help
> Based on your description, I assumed that your list started in cell A2 with a header value, and then
> the actual values started in C3. Apparently, your first entry is in Cell A8. You can either
[quoted text clipped - 86 lines]
> >> >> >
> >> >> > - Show quoted text -