Solved

How to make data validation list drop-down appear in first column of new row?

Posted on 2014-02-25
9
363 Views
Last Modified: 2014-02-26
Hello - I've got a data entry table of 10 columns and 100 rows. I've got col 1 (A) set up with a data validation list. It works fine on the existing 100 rows, but when I go down to row 101 and click in the cell at col A,  the list drop-down arrow does not appear until I actually make an entry in that cell, and move out of it. THEN I see the drop-down arrow appear, and the table expands to include this new row.  

How do you set up the table and/or data validation list to be available on the first blank row of a table?

(This table started out as a range; I selected it, and made a table out of it. Maybe that's my problem?)

This is in Excel 2010

Thanks
0
Comment
Question by:mlagrange
  • 3
  • 3
  • 3
9 Comments
 
LVL 19

Accepted Solution

by:
regmigrant earned 500 total points
ID: 39887210
The table expansion happens after you enter the data and its not until then that validation information is added to the new row

you can past the validation into the rows below the table so the drop down appears before the table expansion (copy, past special, validation)
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 39887250
This seems to work:

1) Create your table

2) Resize your table so that it includes an empty row at the bottom

3) Add this code to the sheet module for the worksheet with the table, to force the table to resize with the extra blank row

Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim lo As ListObject
    Dim loRng As Range
    Dim loLastRow As Range
    
    Set lo = Me.ListObjects(1)
    Set loRng = lo.Range
    Set loLastRow = loRng.Rows(loRng.Rows.Count)
    
    If Not Intersect(loLastRow, Target) Is Nothing Then
        Application.EnableEvents = False
        lo.Resize loRng.Cells(1).Resize(loRng.Rows.Count + 1, loRng.Columns.Count)
        Application.EnableEvents = True
    End If
    
End Sub

Open in new window

0
 

Author Closing Comment

by:mlagrange
ID: 39887251
Great! Thanks again!
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 39887271
Did you have a chance to review my suggestion?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:mlagrange
ID: 39887274
Sorry Patrick - I just saw your post. I was wondering how to do that in code.

Thanks very much for your response.
0
 

Author Comment

by:mlagrange
ID: 39887283
Patrick - I am posting a 2nd question: "How would you do that in VBA?"
If you'll respond, I'll award you that one?

Thanks again

Mark
0
 
LVL 19

Expert Comment

by:regmigrant
ID: 39887318
Patrick- nice piece of code, i'll be saving it for future use but it only works if you tab from last row of table - I tried change it to a selection change event so I can click below the table but it still fires too late - can you think of a better event to attach it to?
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 39887761
regmigrant,

I think you may have missed one of the key points: before deploying the code, you have to make sure that the table contains a blank row at the end.  Then, once a user actually populates a cell in that row, the table resizes.

Patrick
0
 
LVL 19

Expert Comment

by:regmigrant
ID: 39888302
ah, even cooler
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now