메인 컨텐츠로 가기

드롭 다운 목록에서 공백 대신 첫 번째 항목을 표시하는 방법은 무엇입니까?

문서 드롭 다운 목록 기본값은 맨 위로 1

워크 시트의 드롭 다운 목록은 데이터 입력을 더 쉽게하는 데 도움이 될 수 있습니다. 항목을 하나씩 입력하지 않고 선택하기 만하면됩니다. 하지만 가끔 드롭 다운 목록을 클릭하면 다음 스크린 샷과 같이 첫 번째 데이터 항목이 아닌 빈 항목으로 먼저 점프하는 경우가 있는데, 이는 목록 끝에있는 소스 데이터를 삭제하여 발생할 수 있습니다. 빈 데이터 유효성 검사 셀마다 긴 목록의 맨 위로 스크롤해야하는 것은 성 가실 수 있습니다. 이 기사에서는 드롭 다운 목록에서 항상 첫 번째 항목을 표시하는 방법에 대해 설명합니다.

데이터 유효성 검사 기능을 사용하여 공백 대신 드롭 다운 목록에 첫 번째 항목 표시

VBA 코드로 비어있는 대신 드롭 다운 목록의 첫 번째 항목을 자동으로 표시


화살표 블루 오른쪽 거품 데이터 유효성 검사 기능을 사용하여 공백 대신 드롭 다운 목록에 첫 번째 항목 표시

실제로이 작업을 수행하려면 드롭 다운 목록을 만들 때 특정 공식을 적용하기 만하면됩니다. 다음과 같이하십시오.

1. 드롭 다운 목록을 삽입 할 셀을 선택하고 Data > 데이터 유효성 검사 > 데이터 유효성 검사, 스크린 샷 참조 :

문서 드롭 다운 목록 기본값은 맨 위로 2

2. 튀어 나온 데이터 유효성 검사 대화 상자에서 설정 탭에서 명부 인사말 허용 섹션을 입력하고 다음 공식을 입력하십시오. = OFFSET (Sheet3! $ A $ 1,0,0, COUNTA (Sheet3! $ A : $ A) -1,1)출처 텍스트 상자, 스크린 샷 참조 :

주의 사항:이 공식에서 Sheet3 워크 시트에 소스 데이터 목록이 포함되어 있고 A1 목록의 첫 번째 셀 값입니다.

문서 드롭 다운 목록 기본값은 맨 위로 3

3. 그런 다음 OK 버튼, 이제 드롭 다운 목록 셀을 클릭하면 소스 데이터의 끝에서 삭제 된 셀 값이 있는지 여부에 관계없이 첫 번째 데이터 항목이 항상 맨 위에 표시됩니다. 스크린 샷 참조 :

문서 드롭 다운 목록 기본값은 맨 위로 4


화살표 블루 오른쪽 거품 VBA 코드로 비어있는 대신 드롭 다운 목록의 첫 번째 항목을 자동으로 표시

여기서는 데이터 유효성 검사 셀을 클릭 할 때 드롭 다운 목록의 첫 번째 항목을 자동으로 표시하는 데 도움이되는 VBA 코드를 소개 할 수도 있습니다.

1. 드롭 다운 목록을 삽입 한 후 드롭 다운 목록이 포함 된 워크 시트 탭을 선택하고 마우스 오른쪽 버튼을 클릭하여 선택합니다. 코드보기 상황에 맞는 메뉴에서 응용 프로그램 용 Microsoft Visual Basic window를 클릭 한 후 다음 코드를 복사하여 모듈에 붙여 넣습니다.

VBA 코드 : 드롭 다운 목록에 첫 번째 데이터 항목 자동 표시 :

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

문서 드롭 다운 목록 기본값은 맨 위로 5

2. 그런 다음 코드 창을 저장하고 닫으면 드롭 다운 목록 셀을 클릭하면 첫 번째 데이터 항목이 한 번에 표시됩니다.

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
=OFFSET(Sheet3!$A$1,0,0,COUNTA(Sheet3!$A:$A)+2-1,1) I added +2 to the equation and that worked for me.
This comment was minimized by the moderator on the site
For the VDA code, how can I have only a certain cell range show the first item in the drop down list? Thank you in advance.
This comment was minimized by the moderator on the site
Hi, Akrupa,To solve your problem, maybe the following VBA code can help you:

<div data-tag="code">Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice 20211206
Dim xFormula As String
Dim xRg As Range
Dim xStr As String
Dim xIndex As Integer
xIndex = 2 'Here indicates the cell number of the original data,for example,the original data is A1:A10, to display the A2 cell value, please write 2 here.
On Error GoTo Out:
xFormula = Target.Cells(1).Validation.Formula1
If Left(xFormula, 1) = "=" Then
If Target.Value <> "" Then Exit Sub
xStr = Mid(xFormula, 2)
Set xRg = Application.Range(xStr)
Target.Cells(1) = xRg.Cells(xIndex).Value
End If
Out:
End Sub
Please try, hope it can help you!
This comment was minimized by the moderator on the site
Better but not quite. Using the =OFFSET(Sheet3!$A$1,0,0,COUNTA(Sheet3!$A:$A)-1,1) method eliminates the blanks but still starts you at the bottom of the very long list. I want it to start at the top of the list.
This comment was minimized by the moderator on the site
Once again, you save the day! Thanks!
This comment was minimized by the moderator on the site
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..."
This comment was minimized by the moderator on the site
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!
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
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"
This comment was minimized by the moderator on the site
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,....
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations