Skip i'r prif gynnwys

Sut i ddangos yr eitem gyntaf yn y gwymplen yn lle gwag?

rhestr gwympo doc rhagosodedig i'r 1 uchaf

Efallai y bydd y gwymplen mewn taflen waith yn ein helpu i wneud mewnbynnu data yn haws, mae angen i ni ddewis yr eitemau heb eu teipio fesul un. Ond, rywbryd, pan gliciwch ar y gwymplen, mae'n neidio i'r eitemau gwag yn gyntaf yn lle'r eitem ddata gyntaf fel a ganlyn ar y screenshot a ddangosir, gall hyn gael ei achosi trwy ddileu'r data ffynhonnell ar ddiwedd y rhestr. Efallai ei bod yn annifyr bod yn rhaid i chi sgrolio yn ôl i frig rhestr hir ar gyfer pob cell dilysu data gwag. Yr erthygl hon, byddaf yn siarad am sut i ddangos yr eitem gyntaf yn y gwymplen bob amser.

Dangoswch yr eitem gyntaf yn y gwymplen yn lle gwag gyda swyddogaeth Dilysu Data

Dangoswch yr eitem gyntaf yn y gwymplen yn awtomatig yn lle gwag gyda chod VBA


swigen dde glas saeth Dangoswch yr eitem gyntaf yn y gwymplen yn lle gwag gyda swyddogaeth Dilysu Data

Mewn gwirionedd, i gyflawni'r swydd hon, does ond angen i chi gymhwyso fformiwla benodol wrth greu rhestr ostwng, gwnewch fel a ganlyn:

1. Dewiswch y celloedd lle rydych chi am fewnosod y gwymplen, a chlicio Dyddiad > Dilysu Data > Dilysu Data, gweler y screenshot:

rhestr gwympo doc rhagosodedig i'r 2 uchaf

2. Yn y popped allan Dilysu Data blwch deialog, o dan y Gosodiadau tab, dewis rhestr oddi wrth y Caniatáu adran, ac yna nodwch y fformiwla hon: = OFFSET (Taflen3! $ A $ 1,0,0, COUNTA (Taflen3! $ A: $ A) -1,1) i mewn i'r ffynhonnell blwch testun, gweler y screenshot:

Nodyn: Yn y fformiwla hon, Sheet3 yw'r daflen waith yn cynnwys y rhestr ddata ffynhonnell, a A1 yw'r gwerth cell cyntaf yn y rhestr.

rhestr gwympo doc rhagosodedig i'r 3 uchaf

3. Yna cliciwch OK botwm, nawr, pan fyddwch chi'n clicio celloedd y gwymplen, mae'r eitem ddata gyntaf bob amser yn cael ei harddangos ar y brig p'un a oes gwerthoedd celloedd wedi'u dileu ar ddiwedd y data ffynhonnell, gweler y screenshot:

rhestr gwympo doc rhagosodedig i'r 4 uchaf


swigen dde glas saeth Dangoswch yr eitem gyntaf yn y gwymplen yn awtomatig yn lle gwag gyda chod VBA

Yma, gallaf hefyd gyflwyno cod VBA a all eich helpu i ddangos yr eitem gyntaf yn y gwymplen yn awtomatig pan fyddwch chi'n clicio'r celloedd dilysu data.

1. Ar ôl mewnosod y gwymplen, dewiswch y tab taflen waith sy'n cynnwys y gwymplen, a chliciwch ar y dde i ddewis Gweld y Cod o'r ddewislen cyd-destun i fynd i'r Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, ac yna copïo a gludo'r cod canlynol i'r Modiwl:

Cod VBA: Dangoswch yr eitem ddata gyntaf yn y gwymplen yn awtomatig:

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

rhestr gwympo doc rhagosodedig i'r 5 uchaf

2. Yna arbedwch a chau ffenestr y cod, ac yn awr, pan gliciwch ar y gwymplen, bydd yr eitem ddata gyntaf yn cael ei harddangos ar unwaith.

Offer Cynhyrchiant Swyddfa Gorau

Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

tab kte 201905


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
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