Ga naar hoofdinhoud

Hoe converteer ik tekst in een tekstvak naar celinhoud in Excel?

Als een blad enkele tekstvakken bevat en u de inhoud van de tekstvakken afzonderlijk in cellen wilt converteren, zoals onderstaand screenshot, zijn er dan snelle manieren om deze taak op te lossen, behalve één voor één invoeren in Excel? In dit artikel introduceer ik een macro om u een plezier te doen met dit probleem.
doc converteer tekstvak naar cel 1

Converteer de inhoud van het tekstvak naar een cel met VBA


pijl blauw rechts bel Converteer de inhoud van het tekstvak naar een cel met VBA

Behalve macrocode, is er geen truc die tekstvakken snel naar celinhoud kan converteren.

1. druk op Alt + F11 toetsen om in te schakelen Microsoft Visual Basic voor toepassingen venster.

2. klikken Invoegen > Moduleen plak de onderstaande code in het Module scripts.

VBA: converteer tekstvakken naar cel

Sub TextboxesToCell()
'UpdatebyExtendoffice20160918
    Dim xRg As Range
    Dim xRow As Long
    Dim xCol As Long
    Dim xTxtBox As TextBox
    
    Set xRg = Application.InputBox("Select a cell):", "Kutools for Excel", _
                                    ActiveWindow.RangeSelection.AddressLocal, , , , , 8)
    xRow = xRg.Row
    xCol = xRg.Column
    
    For Each xTxtBox In ActiveSheet.TextBoxes
        Cells(xRow, xCol).Value = xTxtBox.Text
        xTxtBox.Delete
        xRow = xRow + 1
    Next
    
End Sub

doc converteer tekstvak naar cel 2

3. druk op F5 toets om de code uit te voeren, verschijnt er een dialoogvenster om u eraan te herinneren een cel te selecteren om de inhoud van het tekstvak te exporteren. Zie screenshot:
doc converteer tekstvak naar cel 3

4. klikken OK. Nu zijn alle tekstvakken geconverteerd naar celinhoud.
doc converteer tekstvak naar cel 4

Tip: Bovenstaande VBA verwijdert de tekstvakken na het uitvoeren, als je de tekstvakken wilt behouden, verander dan de code xTxtBox.Verwijderen naar 'xTxtBox.Verwijderen'.

Uitbreiding:Als u snel wilt converteren tussen nummer en tekst, probeer dan de Kutools voor Excel's te gebruiken Omzetten tussen tekst en nummer zoals weergegeven in de volgende schermafbeelding. Het is volledige functie zonder beperking in

Kutools for Excel, met meer dan 300 handige functies, maakt uw werk eenvoudiger. 
dagen, download en maak nu een gratis proefversie.
doc converteer tekstvak naar cel 5

Beste Office-productiviteitstools

🤖 Kutools AI-assistent: Een revolutie teweegbrengen in de data-analyse op basis van: Intelligente uitvoering   |  Genereer code  |  Aangepaste formules maken  |  Analyseer gegevens en genereer grafieken  |  Roep Kutools-functies aan...
Populaire functies: Zoek, markeer of identificeer duplicaten   |  Verwijder lege rijen   |  Combineer kolommen of cellen zonder gegevens te verliezen   |   Ronde zonder formule ...
Super opzoeken: Meerdere criteria VLookup    VLookup met meerdere waarden  |   VOpzoeken over meerdere bladen   |   Fuzzy opzoeken ....
Geavanceerde vervolgkeuzelijst: Maak snel een vervolgkeuzelijst   |  Afhankelijke vervolgkeuzelijst   |  Multi-select vervolgkeuzelijst ....
Kolom Beheerder: Voeg een specifiek aantal kolommen toe  |  Kolommen verplaatsen  |  Schakel de zichtbaarheidsstatus van verborgen kolommen in  |  Vergelijk bereiken en kolommen ...
Uitgelichte functies: Raster focus   |  Ontwerpweergave   |   Grote formulebalk    Werkmap- en bladbeheer   |  resource Library (Auto-tekst)   |  Datumkiezer   |  Combineer werkbladen   |  Cellen coderen/decoderen    Stuur e-mails per lijst   |  Super filter   |   Speciaal filter (filter vet/cursief/doorhalen...) ...
Top 15 gereedschapsets12 Tekst Tools (toe te voegen tekst, Tekens verwijderen, ...)   |   50+ tabel Types (Gantt Chart, ...)   |   40+ Praktisch Formules (Bereken leeftijd op basis van verjaardag, ...)   |   19 Invoeging Tools (QR-code invoegen, Afbeelding invoegen vanaf pad, ...)   |   12 Camper ombouw Tools (Getallen naar woorden, Currency Conversion, ...)   |   7 Samenvoegen en splitsen Tools (Geavanceerd Combineer rijen, Gespleten cellen, ...)   |   ... en meer

Geef uw Excel-vaardigheden een boost met Kutools voor Excel en ervaar efficiëntie als nooit tevoren. Kutools voor Excel biedt meer dan 300 geavanceerde functies om de productiviteit te verhogen en tijd te besparen.  Klik hier om de functie te krijgen die u het meest nodig heeft...

Omschrijving


Office-tabblad Brengt een interface met tabbladen naar Office en maakt uw werk veel gemakkelijker

  • Schakel bewerken en lezen met tabbladen in Word, Excel, PowerPoint in, Publisher, Access, Visio en Project.
  • Open en maak meerdere documenten in nieuwe tabbladen van hetzelfde venster in plaats van in nieuwe vensters.
  • Verhoogt uw productiviteit met 50% en vermindert honderden muisklikken voor u elke dag!

 

Comments (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I am using this script (thanks by the way), but i am trying to get it so that it populates a specific cell and not ask for a cell input each time. what would I change so that it auto populates for example cell B2.

Cheers
This comment was minimized by the moderator on the site
Hi, just change the script
Set xRg = Application.InputBox("Select a cell):", "Kutools for Excel", _
                                    ActiveWindow.RangeSelection.AddressLocal, , , , , 8)

to
Set xRg = Application.Range("B2")

you will insert textbox contents from cell B2
This comment was minimized by the moderator on the site
Hi, sunny. I want a solution in excel. I have copied and pasted a web page containing data. in that, each text box contains some numbers. I am unable to convert it as a regular number in an excel cell containing a particular column. I am using excel 2007.Your text to link
This comment was minimized by the moderator on the site
Hi, sunny. I want a solution in excel. I have copied and pasted a web page containing data. in that, each text box contains some numbers. I am unable to convert it as a regular number in an excel cell containing a particular column. I am using excel 2007.
This comment was minimized by the moderator on the site
hi, I tried in Excel365 and it doesn't work, I get the popup and then I fill in but then nothing happens, thanks for the help, Michel
This comment was minimized by the moderator on the site
Hi, Michel, I have tested the code in Excel 365, it works correctly. Could you give me a picture about your Excel version like this (File > Account)https://www.extendoffice.com/images/stories/comments/sun-comment/Excel_version.png, and the picture about your textboxes contents?
This comment was minimized by the moderator on the site
No me funcionó. Hago todo lo señalado y no pasa nada después de apretar enter. Intenté algunos cambios en la programación y tampoco
This comment was minimized by the moderator on the site
Hi, Juan, there is no Enter key mentioned in the method above, copy and paste the vba, then press F5 key or click the Run button to enable the code.
This comment was minimized by the moderator on the site
Muchas gracias! Buen aporte. Me ayudó mucho.
This comment was minimized by the moderator on the site
Okay, I have Textbox inside Textbox that need to be extracted.
This comment was minimized by the moderator on the site
VBA not working?!
This comment was minimized by the moderator on the site
It works perfectly here. What happen while you running the code? It changes nothing? If you could, please describ more about your data and problem. Thank you.
This comment was minimized by the moderator on the site
I have many Boxes in different sheets, There are 4 sheets which are having particular events on particular day and i would like to take that text boxes of particular day to new sheet combined for that day, How it works i have no idea how to get that data from 4 different sheet to one sheet.
This comment was minimized by the moderator on the site
Not working here either. Select destination cell, click OK, and nothing happens.
This comment was minimized by the moderator on the site
I have tried it in Win10 Excel2016 and Win8 Excel2010, it works both. What working enviroment you use?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations