Log in
x
or
x
x
Register
x

or

How to show the first item in the drop down list instead of blank?

doc drop down list default to top 1

The drop down list in a worksheet may help us to make data entry easier, we just need to select the items without typing them one by one. But, sometime, when you click the drop down list, it jumps to the blank items first instead of the first data item as following screenshot shown, this may be caused by deleting the source data at the end of the list. It may be annoying that you have to scroll back to the top of a long list for each blank data validation cell. This article, I will talk about how to always show the first item in the drop down list.

Show the first item in drop down list instead of blank with Data Validation function

Automatically show the first item in drop down list instead of blank with VBA code


arrow blue right bubble Show the first item in drop down list instead of blank with Data Validation function


Actually, to achieve this job, you just need to apply a specific formula when you create a drop down list, please do as follows:

1. Select the cells where you want to insert the drop down list, and click Data > Data Validation > Data Validation, see screenshot:

doc drop down list default to top 2

2. In the popped out Data Validation dialog box, under the Settings tab, choose List from the Allow section, and then enter this formula: =OFFSET(Sheet3!$A$1,0,0,COUNTA(Sheet3!$A:$A)-1,1) into the Source text box, see screenshot:

Note: In this formula, Sheet3 is the worksheet contains the source data list, and A1 is the first cell value in the list.

doc drop down list default to top 3

3. Then click OK button, now, when you click the drop down list cells, the first data item always displayed at the top whether there are cell values deleted at the end of the source data, see screenshot:

doc drop down list default to top 4


arrow blue right bubble Automatically show the first item in drop down list instead of blank with VBA code

Here, I can also introduce a VBA code which can help you to show the first item in the drop down list automatically when you click the data validation cells.

1. After inserting the drop down list, select the worksheet tab which contains the drop down list, and right click to choose View Code from the context menu to go to the Microsoft Visual Basic for Applications window , and then copy and paste the following code into the Module:

VBA code: Automatically show the first data item in drop down list:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice 20160725
    Dim xFormula As String
    On Error GoTo Out:
    xFormula = Target.Cells(1).Validation.Formula1
    If Left(xFormula, 1) = "=" Then
        Target.Cells(1) = Range(Mid(xFormula, 1)).Cells(1).Value
    End If
Out:
End Sub

doc drop down list default to top 5

2. Then save and close the code window, and now, when you click the drop down list cell, the first data item will be displayed at once.


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Jason · 6 months ago
    Doesn't work for me. I keep getting an error message that says, "There's a problem with this formula. Not trying to type a formula? When the first character is an equal (+) or minus (-) sign, Exel thinks it's a formula.... To get around this, type an apostrophe (') first..."
  • To post as a guest, your comment is unpublished.
    Justin · 1 years ago
    Hello!

    How can I set a data validation list such that if the drop down value in the cell is deleted, the cell will automatically show a default value (i.e. "-Select-")?

    For example, I have a worksheet with multiple drop down lists that I want to show a default value of "-Select-" once the sheet is opened. A user will select values from the lists that will impact the result of calculations throughout the entire spreadsheet. A user may accidentally "delete" the cell contents of the lists. If this happens, rather than the cell becoming blank, I want the cell to show a default value of "-Select-". This scenario occurs in multiple random locations throughout the spreadsheet, not just in one localized place.

    I was able to find the following VBA code so far, but it only applies the concept over a range, rather than just individual cells that contain drop down lists. The problem with what I have coded so far is that every single blank cell in the range ends up with "-Select-" in it. Some of the lists are in ranges, but some are also scattered throughout the sheet. The problem I'm having with my current code is that every single blank cell in the range ends up with "-Select-" in it. I'm trying to get this to apply over the entire worksheet to ONLY cells that are drop down lists.

    Is what I'm trying to accomplish even possible?

    Example file can be found here:
    https://drive.google.com/file/d/1VoO8VgFs3IJ0ALwqfk0i8gt69UE4vEKW/view?usp=sharing

    Example code:

    Option Explicit

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cel As Range
    ' If Target.Cells.Count > 1 Then Exit Sub 'turning this off allows multiple cells to be selected and deleted at the same time
    If Not Intersect(Target, Range("f2:p17")) Is Nothing Then
    For Each cel In Range("f2:p17")
    Application.EnableEvents = False
    If IsEmpty(cel.Value) Then cel.Value = "-Select-"
    Next cel
    End If
    Application.EnableEvents = True
    End Sub


    Thanks in advance!
  • To post as a guest, your comment is unpublished.
    Justin · 1 years ago
    How can I set a data validation list such that if the drop down value in the cell is deleted, the cell will automatically show the a default value (i.e. "-Select-")?

    For example, I have a worksheet with multiple drop down lists that I want to show a default value of "-Select-" once the sheet is opened. A user will select values from the lists that will impact the result of calculations throughout the entire spreadsheet. A user may accidentally "delete" the cell contents. If this happens, rather than the cell becoming blank, I want the cell to show a default value of "-Select-". This scenario occurs in multiple random locations throughout the spreadsheet, not just in one localized place.

    I was able to come up with the following VBA code so far, but I've only figured out how to apply the concept over a range, rather than just cells that contain a drop down list. The problem with what I have coded so far is that every single blank cell in the range ends up with "-Select-" in it.

    Option Explicit

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cel As Range
    ' If Target.Cells.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("f2:p17")) Is Nothing Then
    For Each cel In Range("f2:p17")
    Application.EnableEvents = False
    If IsEmpty(cel.Value) Then cel.Value = "-Select-"
    Next cel
    End If
    Application.EnableEvents = True
    End Sub
  • To post as a guest, your comment is unpublished.
    frans eilering · 1 years ago
    select the cell in which you have put the listitem
    the range for the listitem is "Opleiding"
    in your VBA code:

    selection.Value = Range("opleiding").Cells(2, 1)

    the result is that the selected item of the listItem is the second item in the range "Opleiding"
  • To post as a guest, your comment is unpublished.
    DHARAMVIR · 2 years ago
    After scroll down select to cells numeric data not come in series only first cell data come
    select 1,2 different cells and scroll down value not coming 1,2,3,4,5....... only first cell value coming 1,1,1,1,....