Denne kode skal stå i den celle son datage skal vises i (på ark 2) Skal selvfølgelig være: =ark2!A1 hvis der er a1 som indeholder den data som skal overføres :-)
You can create a dropdown list that gets its choices from cells elsewhere on the worksheet.
Type the entries for the dropdown list in a single column or row. Do not include blank cells in the list. If you type the list on a different worksheet from the data entry cell, define a name for the list.
How?
Select the cell, range of cells, or nonadjacent selections that you want to name. Click the Name box at the left end of the formula bar (formula bar: A bar at the top of the Excel window that you use to enter or edit values or formulas in cells or charts. Displays the constant value or formula stored in the active cell.) .
Name box
Type the name for the cells. Press ENTER. Note You cannot name a cell while you are changing the contents of the cell.
If you type the list in a different workbook, define a name with an external reference to the list.
How?
Open the workbook that contains the list of dropdown entries. Open the workbook where you want to validate cells, point to Name on the Insert menu, and then click Define. In the Names in workbook box, type the name. In the Refers to box, delete the contents, and keep the insertion pointer in the box. On the Window menu, click the name of the workbook that contains the list of dropdown entries, and then click the worksheet that contains the list. Select the cells containing the list. In the Define Name dialog box, click Add, and then click Close. Select the cell where you want the dropdown list. On the Data menu, click Validation, and then click the Settings tab. In the Allow box, click List. If the list is in the same worksheet, enter a reference to your list in the Source box. If the list is elsewhere, enter the name you defined for your list in the Source box.
Make sure the reference or name is preceded with an equal sign (=).
Make sure the In-cell dropdown check box is selected. Specify whether the cell can be left blank: Select or clear the Ignore blank check box. To display optional input instructions when the cell is clicked, click the Input Message tab, make sure the Show input message when cell is selected check box is selected, and then fill in the title and text for the message. Specify how you want Microsoft Excel to respond when invalid data is entered. How?
Click the Error Alert tab, and make sure the Show error alert after invalid data is entered check box is selected.
Select one of the following options for the Style box:
To display an information message that does not prevent entry of invalid data, click Information.
To display a warning message that does not prevent entry of invalid data, click Warning.
To prevent entry of invalid data, click Stop.
Fill in the title and text for the message (up to 225 characters).
Note If you don't enter a title or text, the title defaults to " Microsoft Excel" and the message to: "The value you entered is not valid. A user has restricted values that can be entered into this cell."
Note Applying data validation to a cell does not format the cell. Tip
If the entry list is short, you can type the entries directly in the Source box, separated by the Microsoft Windows list separator character (commas by default). For example, you could type Low, Average, High in the Source box instead of entering the three words on a worksheet.
OK. Du starter med at oprette en range på ark2. Her markerer du de felter som indeholder de værdiger, som du gerne vil have med i din dropdown liste. Når du har cellerne markeret skriver du et navn på din range i feltet ved siden at kode linien (der hvor der står A1 når men er i A1), skal vi kalde den for TestRange :-)
Så markerer du den celle som skal indeholde dropdown listen. Klikker på Data / Validation. Under Allow vælger du LIST. I Source skriver du =TestRange.
Det virker sku da fint! Men det var ikke helt det jeg havde i tankerne... Når jeg laver TestRangen i Ark2 vælger jeg på samme linie data for en kunde: navn, adresse postnr. osv. Når jeg så vil vælge kunden i drob down boksen, skal alle relevante felter fyldes med TestRange data...
Nu har jeg prøvet at lægge formlen ind som du beskrev, dog lidt redigeret: =LOPSLAG(A1;Kunder!A1:E100;2). Den har jeg sat ind i B1 på Ark2(Kunder). Så siger Excel at jeg ikke kan oprette en cirkulær reference. Men hvordan skal formlen vide i hvilke felter resten af teksten skal stå?
LOPSLAGS-funktionen skal ikke indsættes på Ark2 men på Ark1 hvor du vil have hentet informationerne fra Ark 2.
Den cirkulære reference skyldes netop at du i celle B1 på Ark2 referer til et områder, der bl.a. dækker celle B1.
LOPSLAG() gør det at den slår en værdi op i en tabel og returnerer informationer, der står til højre for den fundnu værdi i tabellen.
De 3 oplysninger i LOPSLAG-parantesen er: A1: Den celle hvor du indtaster den værdi, der skal søges efter i tabellen. Ark2!A1:D100: Tabellen hvori, der søges. I dette tilfælde et område på Ark2. 2: Kolonnenummeret i tabellen. 2-tallet fortæller at det er den anden kolonne i tabellen (A1:D100), der ønskes hentet for den fundne værdi. ". kolonne er informationen i B-kolonnen (et 3-tal referer i mit eksempel fra 30.12.03 til C-kolonnen, og et 4-tal til D-kolonnen)
Forstår ikke fejlmeddelelsen om at du ikke kan hente fra andet ark - hvilken Excel-version arbejder du med? Prøv at navngive området med tabellen på Ark2, og brug dette navn i stedet for Ark2!A1:D100
Jeg har kigget lidt med, og har i den forbindelse oprettet en Excel fil som gør som du vil (tror jeg) og det er løst på Eriks møde. Vil det hjælpe hvis jeg sender filen til dig.
Jeg ved godt, at man selv skal prøve at løse problemet med andres hjælp, men det må man da sige at du også har.
PS jeg vil ikke stjæle Eriks points da det er hans læsning som jeg har brugt :-)
Da erikjuul har lavet en komplet løsning (Tak for det!) får han størstedelen. Og tak til flashit for at sætte de grå i gang...
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.