View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Mycelium Mycelium is offline
external usenet poster
 
Posts: 21
Default Dropdown List Add New Feature Needed

On Sat, 04 Jul 2009 11:48:44 -0700, Gord Dibben <gorddibbATshawDOTca
wrote:


There are no MS "you guys" hanging around here.

Just a bunch of users like yourself who volunteer their time and expertise
to try to assist other users.

We have no engines in which to incorporate your requests.


The remark was OBVIOUSLY directed toward the MS AUTHORS, ya dope.

Use a little common sense.


Gord Dibben MS Excel MVP

On Sat, 04 Jul 2009 11:10:09 -0700, Mycelium
g wrote:

Thank you. I will try this out.

Ideally, I wanted the last line in a drop down list (from the array I
suppose) to be "add new" or the like, and selecting it would pop the user
over to the array at a new, blank line entry just above the "Add New"
line.

Heck, this should be a feature you guy incorporate into your engine so
that a user with a defined drop down list array can easily add a new line
by clicking the last line in the drop down, which would be tagged as "Add
New".

This should already be part of the MS drop down code/function engine.
Sad that it is not.

Get those programmers to coding there! :-)

Thanks again.



On Sat, 4 Jul 2009 11:41:19 +0100, "Patrick Molloy"
wrote:

paste this code to a new module. The test procedure passes a range object to
the AddNewLine procedure

Option Explicit
Sub TEST()
AddNewLine Worksheets("Sheet1").Range("MyData")
ActivateRange Worksheets("Sheet1").Range("MyData")
End Sub

Sub AddNewLine(target As Range)
Dim bAvailable As Boolean
Dim cell As Range
Dim rName As String
bAvailable = True
'check space below is not used
With target
For Each cell In .Offset(.Rows.Count).Resize(2).Cells
If Not IsEmpty(cell) Then
bAvailable = False
Exit For
End If
Next
If bAvailable Then
.Rows(.Rows.Count).Copy
rName = .Name.Name
With .Resize(.Rows.Count + 1)
'.Rows(.Rows.Count).Copy
.Rows(.Rows.Count).PasteSpecial xlADORecordset
.Name = rName
.Rows(.Rows.Count).ClearContents ' omit if you need
formula
End With
Else
MsgBox "No room below table to textend it"
End If
End With
End Sub

Sub ActivateRange(target As Range)
With target
.Parent.Activate
.Cells(.Rows.Count, 1).Select
End With
End Sub


you can replicate this several ways.
one would be to have a cell on a sheet with a button next to it. the button
would have a macro assigned to it like:
sub ButtonClick()
AddNewLine Range( Range("A1") )
End sub

where cell A1 holds the name of the range you want to add to,

This isn't complete - but if its the right direction, then we're getting
somewhere.




_____________________

Hi folks.

How can I create a button or list entry that takes the user to a cell to
add a "new item" or "new user" to a dropdown list array by way of row
insertion and cursor placement... that takes the last entry in the
existing drop down list to use as an "add new" "button" or trigger?


The event is to add a new row to an existing named array, which
automatically updates all code in the workbook, if the row is inserted
from within the existing array.


So the last entry in the drop down list array could (would) be an "Add
New" selection for the user to choose. When the fill is performed, the
action could be to test that cell content and act accordingly. The user
would get switched to the array with the cursor in the left most cell of
the newly inserted row. This also has the effect of keeping the cell
formatting as well for solid color arrays, that is.


Is this possible? I suppose a test loop that tests the cell content,or
one that tests for and grabs the content even before it makes it to a
cell. Anyway, when one selects the add new selection from the drop down
list, instead of filling that data into the cell, it performs the insert
and pop over function so that a new record can be added.


I have a sheet that has about eight small,named arrays on it and use it
as a master data sheet for a 'presentation' type sheet that draws much of
its data from lookups to the array sheet.


A simple row insertion on that sheet updates all arrays, etc. in the
entire workbook. Nice job, guys. I LIKE IT!


So, anyway, is this a good approach for expanding the contents of an
array? Is keeping all these arrays on a single sheet a good approach?
This is like yet another new form of a database configuration, in the
final analysis. Thanks for any thoughts or views.


At least one inquiring mind wants to know.